{"thread":{"id":"20076","subject":"Pushing to GitHub doesn't push all branches","startedAt":"2009-07-10T13:24:55Z","lastAt":"2009-07-13T13:41:11Z","messageCount":8,"participants":["Graeme Geldenhuys","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"117768","messageId":"h37fga$5ie$1@ger.gmane.org","threadId":"20076","inReplyTo":null,"subject":"Pushing to GitHub doesn't push all branches","fromName":"Graeme Geldenhuys","fromEmail":"graemeg@gmail.com","sentAt":"2009-07-10T13:24:55Z","receivedAt":"2009-07-10T13:24:55Z","isPatch":false,"sender":{"key":"graemeg@gmail.com","avatar":"https://gravatar.com/avatar/fdaae0cf0a07bd33782720fb37ae0450f504d4e04c57c6e8f3517d11d503fdc6?d=mp&s=160"},"body":"Hi,\n\nWhat am I doing wrong here.  I 'git svn clone' a SubVersion repository \nand when it was done, I was placed in the \"master\" branch, which seems \nto track the \"trunk\" branch of the remote.\n\nI then added GitHub as a remote repository:\n\n$ git remote add origin git@github.com:graemeg/freepascal.git\n\nI then tried to push all the SubVersion branches to GitHub, but only the \n\"master\" branch went through.  I thought the --mirror will push everything.\n\nAny ideas?\n\nYou can view the repository on GitHub with your Web Browser at this URL:\n   http://github.com/graemeg/freepascal/tree\nAs you will notice, under the \"all branches\" option, only \"master\" is \navailable.\n\n\n=======================\n$ git branch -a\n* master\n   remotes/aspect\n   remotes/avr\n   remotes/cleanroom\n   remotes/cpstr\n   remotes/ctypes\n   remotes/fixes_2_0\n   remotes/fixes_2_2\n   remotes/fixes_2_2_0_dos\n   remotes/florian\n   remotes/fpc_2_3\n   remotes/generics\n   remotes/genfunc\n   remotes/inline\n   remotes/janbruns\n   remotes/linker\n   remotes/linker@2665\n   remotes/llvm\n   remotes/merged\n   remotes/newthreading\n   remotes/objc\n   remotes/origin/master\n   remotes/rc_2_2_2\n   remotes/release_2_1_2x\n   remotes/release_2_2_4_rc1\n   remotes/resources\n   remotes/ssa\n   remotes/tags/release_2_0_0\n   remotes/tags/release_2_0_2\n   remotes/tags/release_2_0_4\n   remotes/tags/release_2_0_4_macos\n   remotes/tags/release_2_0_4_rc1\n   remotes/tags/release_2_0_4_rc2\n   remotes/tags/release_2_0_4_rc3\n   remotes/tags/release_2_1_2\n   remotes/tags/release_2_1_4\n   remotes/tags/release_2_2_0\n   remotes/tags/release_2_2_2\n   remotes/tags/release_2_2_2_rc1\n   remotes/tags/release_2_2_2_rc2\n   remotes/tags/release_2_2_4\n   remotes/tags/test_2_0_4\n   remotes/tags/test_2_0_4_1\n   remotes/trunk\n   remotes/tue\n   remotes/unicodertl\n   remotes/unicodestring\n   remotes/unitrw\n   remotes/wpo\n=======================\n\n\n$ git push -v --mirror origin\nPushing to git@github.com:graemeg/freepascal.git\nCounting objects: 130317, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (38881/38881), done.\nWriting objects: 100% (130317/130317), 54.53 MiB | 51 KiB/s, done.\nTotal 130317 (delta 100296), reused 120757 (delta 90739)\nTo git@github.com:graemeg/freepascal.git\n  * [new branch]      master -> master\n  * [new branch]      aspect -> aspect\n  * [new branch]      avr -> avr\n  * [new branch]      cleanroom -> cleanroom\n  * [new branch]      cpstr -> cpstr\n  * [new branch]      ctypes -> ctypes\n  * [new branch]      fixes_2_0 -> fixes_2_0\n  * [new branch]      fixes_2_2 -> fixes_2_2\n  * [new branch]      fixes_2_2_0_dos -> fixes_2_2_0_dos\n  * [new branch]      florian -> florian\n  * [new branch]      fpc_2_3 -> fpc_2_3\n  * [new branch]      generics -> generics\n  * [new branch]      genfunc -> genfunc\n  * [new branch]      inline -> inline\n  * [new branch]      janbruns -> janbruns\n  * [new branch]      linker -> linker\n  * [new branch]      linker@2665 -> linker@2665\n  * [new branch]      llvm -> llvm\n  * [new branch]      merged -> merged\n  * [new branch]      newthreading -> newthreading\n  * [new branch]      objc -> objc\n  * [new branch]      rc_2_2_2 -> rc_2_2_2\n  * [new branch]      release_2_1_2x -> release_2_1_2x\n  * [new branch]      release_2_2_4_rc1 -> release_2_2_4_rc1\n  * [new branch]      resources -> resources\n  * [new branch]      ssa -> ssa\n  * [new branch]      tags/release_2_0_0 -> tags/release_2_0_0\n  * [new branch]      tags/release_2_0_2 -> tags/release_2_0_2\n  * [new branch]      tags/release_2_0_4 -> tags/release_2_0_4\n  * [new branch]      tags/release_2_0_4_macos -> tags/release_2_0_4_macos\n  * [new branch]      tags/release_2_0_4_rc1 -> tags/release_2_0_4_rc1\n  * [new branch]      tags/release_2_0_4_rc2 -> tags/release_2_0_4_rc2\n  * [new branch]      tags/release_2_0_4_rc3 -> tags/release_2_0_4_rc3\n  * [new branch]      tags/release_2_1_2 -> tags/release_2_1_2\n  * [new branch]      tags/release_2_1_4 -> tags/release_2_1_4\n  * [new branch]      tags/release_2_2_0 -> tags/release_2_2_0\n  * [new branch]      tags/release_2_2_2 -> tags/release_2_2_2\n  * [new branch]      tags/release_2_2_2_rc1 -> tags/release_2_2_2_rc1\n  * [new branch]      tags/release_2_2_2_rc2 -> tags/release_2_2_2_rc2\n  * [new branch]      tags/release_2_2_4 -> tags/release_2_2_4\n  * [new branch]      tags/test_2_0_4 -> tags/test_2_0_4\n  * [new branch]      tags/test_2_0_4_1 -> tags/test_2_0_4_1\n  * [new branch]      trunk -> trunk\n  * [new branch]      tue -> tue\n  * [new branch]      unicodertl -> unicodertl\n  * [new branch]      unicodestring -> unicodestring\n  * [new branch]      unitrw -> unitrw\n  * [new branch]      wpo -> wpo\nupdating local tracking ref 'refs/remotes/origin/master'\n\n\nRegards,\n   - Graeme -\n\n-- \nfpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal\nhttp://opensoft.homeip.net/fpgui/\n"},{"id":"117769","messageId":"4A575416.2090304@drmicha.warpmail.net","threadId":"20076","inReplyTo":"h37fga$5ie$1@ger.gmane.org","subject":"Re: Pushing to GitHub doesn't push all branches","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-07-10T14:45:42Z","receivedAt":"2009-07-10T14:45:42Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Graeme Geldenhuys venit, vidit, dixit 10.07.2009 15:24:\n> Hi,\n> \n> What am I doing wrong here.  I 'git svn clone' a SubVersion repository \n> and when it was done, I was placed in the \"master\" branch, which seems \n> to track the \"trunk\" branch of the remote.\n> \n> I then added GitHub as a remote repository:\n> \n> $ git remote add origin git@github.com:graemeg/freepascal.git\n> \n> I then tried to push all the SubVersion branches to GitHub, but only the \n> \"master\" branch went through.  I thought the --mirror will push everything.\n> \n> Any ideas?\n> \n> You can view the repository on GitHub with your Web Browser at this URL:\n>    http://github.com/graemeg/freepascal/tree\n> As you will notice, under the \"all branches\" option, only \"master\" is \n> available.\n> \n> \n> =======================\n> $ git branch -a\n> * master\n>    remotes/aspect\n>    remotes/avr\n>    remotes/cleanroom\n>    remotes/cpstr\n>    remotes/ctypes\n>    remotes/fixes_2_0\n>    remotes/fixes_2_2\n>    remotes/fixes_2_2_0_dos\n>    remotes/florian\n>    remotes/fpc_2_3\n>    remotes/generics\n>    remotes/genfunc\n>    remotes/inline\n>    remotes/janbruns\n>    remotes/linker\n>    remotes/linker@2665\n>    remotes/llvm\n>    remotes/merged\n>    remotes/newthreading\n>    remotes/objc\n>    remotes/origin/master\n>    remotes/rc_2_2_2\n>    remotes/release_2_1_2x\n>    remotes/release_2_2_4_rc1\n>    remotes/resources\n>    remotes/ssa\n>    remotes/tags/release_2_0_0\n>    remotes/tags/release_2_0_2\n>    remotes/tags/release_2_0_4\n>    remotes/tags/release_2_0_4_macos\n>    remotes/tags/release_2_0_4_rc1\n>    remotes/tags/release_2_0_4_rc2\n>    remotes/tags/release_2_0_4_rc3\n>    remotes/tags/release_2_1_2\n>    remotes/tags/release_2_1_4\n>    remotes/tags/release_2_2_0\n>    remotes/tags/release_2_2_2\n>    remotes/tags/release_2_2_2_rc1\n>    remotes/tags/release_2_2_2_rc2\n>    remotes/tags/release_2_2_4\n>    remotes/tags/test_2_0_4\n>    remotes/tags/test_2_0_4_1\n>    remotes/trunk\n>    remotes/tue\n>    remotes/unicodertl\n>    remotes/unicodestring\n>    remotes/unitrw\n>    remotes/wpo\n> =======================\n> \n> \n> $ git push -v --mirror origin\n> Pushing to git@github.com:graemeg/freepascal.git\n> Counting objects: 130317, done.\n> Delta compression using up to 2 threads.\n> Compressing objects: 100% (38881/38881), done.\n> Writing objects: 100% (130317/130317), 54.53 MiB | 51 KiB/s, done.\n> Total 130317 (delta 100296), reused 120757 (delta 90739)\n> To git@github.com:graemeg/freepascal.git\n>   * [new branch]      master -> master\n>   * [new branch]      aspect -> aspect\n>   * [new branch]      avr -> avr\n>   * [new branch]      cleanroom -> cleanroom\n>   * [new branch]      cpstr -> cpstr\n>   * [new branch]      ctypes -> ctypes\n>   * [new branch]      fixes_2_0 -> fixes_2_0\n>   * [new branch]      fixes_2_2 -> fixes_2_2\n>   * [new branch]      fixes_2_2_0_dos -> fixes_2_2_0_dos\n>   * [new branch]      florian -> florian\n>   * [new branch]      fpc_2_3 -> fpc_2_3\n>   * [new branch]      generics -> generics\n>   * [new branch]      genfunc -> genfunc\n>   * [new branch]      inline -> inline\n>   * [new branch]      janbruns -> janbruns\n>   * [new branch]      linker -> linker\n>   * [new branch]      linker@2665 -> linker@2665\n>   * [new branch]      llvm -> llvm\n>   * [new branch]      merged -> merged\n>   * [new branch]      newthreading -> newthreading\n>   * [new branch]      objc -> objc\n>   * [new branch]      rc_2_2_2 -> rc_2_2_2\n>   * [new branch]      release_2_1_2x -> release_2_1_2x\n>   * [new branch]      release_2_2_4_rc1 -> release_2_2_4_rc1\n>   * [new branch]      resources -> resources\n>   * [new branch]      ssa -> ssa\n>   * [new branch]      tags/release_2_0_0 -> tags/release_2_0_0\n>   * [new branch]      tags/release_2_0_2 -> tags/release_2_0_2\n>   * [new branch]      tags/release_2_0_4 -> tags/release_2_0_4\n>   * [new branch]      tags/release_2_0_4_macos -> tags/release_2_0_4_macos\n>   * [new branch]      tags/release_2_0_4_rc1 -> tags/release_2_0_4_rc1\n>   * [new branch]      tags/release_2_0_4_rc2 -> tags/release_2_0_4_rc2\n>   * [new branch]      tags/release_2_0_4_rc3 -> tags/release_2_0_4_rc3\n>   * [new branch]      tags/release_2_1_2 -> tags/release_2_1_2\n>   * [new branch]      tags/release_2_1_4 -> tags/release_2_1_4\n>   * [new branch]      tags/release_2_2_0 -> tags/release_2_2_0\n>   * [new branch]      tags/release_2_2_2 -> tags/release_2_2_2\n>   * [new branch]      tags/release_2_2_2_rc1 -> tags/release_2_2_2_rc1\n>   * [new branch]      tags/release_2_2_2_rc2 -> tags/release_2_2_2_rc2\n>   * [new branch]      tags/release_2_2_4 -> tags/release_2_2_4\n>   * [new branch]      tags/test_2_0_4 -> tags/test_2_0_4\n>   * [new branch]      tags/test_2_0_4_1 -> tags/test_2_0_4_1\n>   * [new branch]      trunk -> trunk\n>   * [new branch]      tue -> tue\n>   * [new branch]      unicodertl -> unicodertl\n>   * [new branch]      unicodestring -> unicodestring\n>   * [new branch]      unitrw -> unitrw\n>   * [new branch]      wpo -> wpo\n> updating local tracking ref 'refs/remotes/origin/master'\n> \n> \n> Regards,\n>    - Graeme -\n> \n\ngit-svn's standard ref structure makes it easy to shoot yourself into\nthe foot, and so does \"--mirror\". Combining the two is really a powerful\nweapon :)\n\n$git ls-remote   git://github.com/graemeg/freepascal.git\n840169d189370c3b08760654800990404b2218df        HEAD\n840169d189370c3b08760654800990404b2218df        refs/heads/master\n3a5d5a06bbe62fada139c86438348e30ff4fcbe7        refs/remotes/aspect\nf8a21acf439e698e7cb57a2a68401cfca2486c0c        refs/remotes/avr\n78d1c138d4755f26ae1515842fcf36f13bf6b030        refs/remotes/cleanroom\nb2701a7710bc343257b47738a06cb1290cec902f        refs/remotes/cpstr\n92c78d3c8efe0bce64fda3f949596f37465bb6bb        refs/remotes/ctypes\n\netc.\n\nYou really mirrored your repo: All your \"lost\" branches are remotes on\nthe github side as well. That has two consequences:\n\n1) They're not shown in the shiny interface.\n2) They don't get cloned when someone clones from there.\n\nAt least 2) is completely unrelated to github, btw.\n\nI think what you really want is to push everything under remote\n(assuming there are only svn branches) into proper heads on github, i.e.\na refspec like '+refs/remotes/*:refs/*' for your pushes.\n\nI assume you want to push master only if it differs from trunk, i.e. if\nthat repos is going to host not only the svn mirror but also your\nadditions. (I don't recommended that, a fork is better for that.)\n\nMichael\n"},{"id":"117770","messageId":"4A575711.1050007@drmicha.warpmail.net","threadId":"20076","inReplyTo":"4A575416.2090304@drmicha.warpmail.net","subject":"Re: Pushing to GitHub doesn't push all branches","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-07-10T14:58:25Z","receivedAt":"2009-07-10T14:58:25Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Michael J Gruber venit, vidit, dixit 10.07.2009 16:45:\n...\n> I think what you really want is to push everything under remote\n> (assuming there are only svn branches) into proper heads on github, i.e.\n> a refspec like '+refs/remotes/*:refs/*' for your pushes.\n\nUhm, make that '+refs/remotes/*:refs/heads/*' ;)\n"},{"id":"117771","messageId":"h37lh2$q3s$1@ger.gmane.org","threadId":"20076","inReplyTo":"4A575416.2090304@drmicha.warpmail.net","subject":"Re: Pushing to GitHub doesn't push all branches","fromName":"Graeme Geldenhuys","fromEmail":"graemeg@gmail.com","sentAt":"2009-07-10T15:07:43Z","receivedAt":"2009-07-10T15:07:43Z","isPatch":false,"sender":{"key":"graemeg@gmail.com","avatar":"https://gravatar.com/avatar/fdaae0cf0a07bd33782720fb37ae0450f504d4e04c57c6e8f3517d11d503fdc6?d=mp&s=160"},"body":"Michael J Gruber wrote:\n> \n> You really mirrored your repo: All your \"lost\" branches are remotes on\n> the github side as well. That has two consequences:\n\nThe two branches that are of most importance to me, is \"trunk\" and \n\"fixes_2_2\" as found in the SubVersion repository.\n\nrefs/remotes/trunk\nrefs/remotes/fixes_2_2\n\n\nSo should I have only pushed the above mentioned branches, but as \"true\" \nheads in GitHub. Geesh, I hope I am understanding what I am typing, \nbecause I feel a bit lost now. :-)\n\nIs there any way to clean up the mess available on GitGub? So that 'git \nls-remote ...' will only show the real remotes.... Or should there be no \nremotes on GitHub?\n\nSorry, I'm fairly new to Git and it feels like I jumped into the deap \nend here. ;-)\n\n> (assuming there are only svn branches) into proper heads on github, i.e.\n> a refspec like '+refs/remotes/*:refs/*' for your pushes.\n\nI'll read the man pages on what that refspec means...  If I manage to \nonly push 'trunk' which is master under git and 'fixes_2_2' which will \nbe some other name under git, how to I keep both those in sync with the \nSubVersion repository.\n\nAt the moment I have a cronjob that executes the following every 30 minutes.\n====================\ncd /mnt/samba/git/fpc.git/\n$GIT checkout master\n$GIT svn rebase\n$GIT gc --auto\n$GIT push origin master\n====================\n\nDoes 'git svn rebase' get all branch or does it just update \"master\" \n(Trunk from SubVersion)?\n\nI apologise for all the questions...\n\nRegards,\n   - Graeme -\n\n-- \nfpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal\nhttp://opensoft.homeip.net/fpgui/\n"},{"id":"117774","messageId":"4A57639D.4020305@drmicha.warpmail.net","threadId":"20076","inReplyTo":"h37lh2$q3s$1@ger.gmane.org","subject":"Re: Pushing to GitHub doesn't push all branches","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-07-10T15:51:57Z","receivedAt":"2009-07-10T15:51:57Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Graeme Geldenhuys venit, vidit, dixit 10.07.2009 17:07:\n> Michael J Gruber wrote:\n>>\n>> You really mirrored your repo: All your \"lost\" branches are remotes on\n>> the github side as well. That has two consequences:\n> \n> The two branches that are of most importance to me, is \"trunk\" and \n> \"fixes_2_2\" as found in the SubVersion repository.\n> \n> refs/remotes/trunk\n> refs/remotes/fixes_2_2\n> \n> \n> So should I have only pushed the above mentioned branches, but as \"true\" \n> heads in GitHub. Geesh, I hope I am understanding what I am typing, \n> because I feel a bit lost now. :-)\n> \n> Is there any way to clean up the mess available on GitGub? So that 'git \n> ls-remote ...' will only show the real remotes.... Or should there be no \n> remotes on GitHub?\n> \n> Sorry, I'm fairly new to Git and it feels like I jumped into the deap \n> end here. ;-)\n> \n>> (assuming there are only svn branches) into proper heads on github, i.e.\n>> a refspec like '+refs/remotes/*:refs/*' for your pushes.\n> \n> I'll read the man pages on what that refspec means...  If I manage to \n> only push 'trunk' which is master under git and 'fixes_2_2' which will \n> be some other name under git, how to I keep both those in sync with the \n> SubVersion repository.\n> \n> At the moment I have a cronjob that executes the following every 30 minutes.\n> ====================\n> cd /mnt/samba/git/fpc.git/\n> $GIT checkout master\n> $GIT svn rebase\n> $GIT gc --auto\n> $GIT push origin master\n> ====================\n> \n> Does 'git svn rebase' get all branch or does it just update \"master\" \n> (Trunk from SubVersion)?\n> \n> I apologise for all the questions...\n\nPlease don't! That's what we're here for ;)\n\nA while ago I suggested that by default, no clone (whether git or\ngit-svn) should have a master branch. I guess your example shows why. If\nyou use that repo (/mnt/samba/git/fpc.git) only for converting from svn\nto git, not for doing local work, then you don't need any master branch.\nBut git-svn will stubbornly recreate one.\n\nSimilarly (under the same assumption), you don't need to rebase at all.\nAll you need is \"git svn fetch\", which populates the branches under\nremotes/.\n\nYou can safely delete the bogus remote branches on github using\n\ngit push origin :refs/remotes/trunk\n\netc., i.e.\n\ngit for-each-ref --shell --format=\"git push -f origin :%(refname)\"\nrefs/remotes/|while read line; do eval $line;done\n\n(all on one line)\n\nThen it's probably beneficial to do something like\n\ngit config remote.origin.push '+refs/remotes/*:refs/heads/*'\n\nso that you have a nice default refspec for origin. [You may think about\nrenaming origin to destination, though ;) ]\n\nCheers,\nMichael\n"},{"id":"117889","messageId":"h3eqap$cov$1@ger.gmane.org","threadId":"20076","inReplyTo":"4A57639D.4020305@drmicha.warpmail.net","subject":"Re: Pushing to GitHub doesn't push all branches","fromName":"Graeme Geldenhuys","fromEmail":"graemeg@gmail.com","sentAt":"2009-07-13T08:12:17Z","receivedAt":"2009-07-13T08:12:17Z","isPatch":false,"sender":{"key":"graemeg@gmail.com","avatar":"https://gravatar.com/avatar/fdaae0cf0a07bd33782720fb37ae0450f504d4e04c57c6e8f3517d11d503fdc6?d=mp&s=160"},"body":"Michael J Gruber wrote:\n> \n> Please don't! That's what we're here for ;)\n\n:) Thanks.\n\n\n> git for-each-ref --shell --format=\"git push -f origin :%(refname)\"\n> refs/remotes/|while read line; do eval $line;done\n\nOK, done this. 'git ls-remote github' doesn't show any remotes/* \nreferences anymore.\n\nOh by the way, I followed your advice and renamed 'origin' to 'github' \nso it makes a bit more sense. I used the following command:\n\n   $ git remote rename origin github\n\n\n> \n> git config remote.origin.push '+refs/remotes/*:refs/heads/*'\n\nOK, I've done this, but I'm not 100% sure what this means. This is what \nI think (from reading various git help and users guide). Any branches I \nhave which track remote references (from svn repository) will be pushed \nto github as various head references (normal branches).  Is this correct?\n\nOn our server, which contain the svn cloned repository and the one that \nis only used for syncing svn -> our server -> github, I had to add a new \ncommit which represents the svn-ignore meta data to a .gitignore file. I \nnoticed I had to manually to a 'git checkout master' & 'git merge \nremotes/trunk' to pull in new updates. I thin pushed that to github.\n\nSo what is my twice hourly cron script supposed to look like? Is the \nfollowing still ok?\n\n========[ script executed by cron every 30 minutes ]============\n#!/bin/sh\nGIT=\"/usr/local/bin/git\"\n\n# FPC repository\ncd /mnt/samba/git/fpc.git/\n$GIT checkout master\n$GIT svn fetch\n$GIT gc --auto\n$GIT push github master\n==============================\n\nOr do I need to add a new line after '$GIT svn fetch' that does a merge.\n\n==============================\n$GIT svn fetch\n$GIT merge remotes/trunk\n...\npush to github\n==============================\n\n\nAlso what do I do with the other branch I want to track. It's called \nremotes/fixes_2_2.\n\nI believe I need to first create a local branch.\n\n   git branch --track fixes_2_2 remotes/fixes_2_2\n\nWhat do I need to modify in my cron script to keep both the master & \nfixes_2_2 branches in sync with SubVersion and push both to GitHub. I \nwant Github to show two branches: master & fixes_2_2\n\n\n\nRegards,\n   - Graeme -\n\n-- \nfpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal\nhttp://opensoft.homeip.net/fpgui/\n"},{"id":"117899","messageId":"4A5B13FB.4040203@drmicha.warpmail.net","threadId":"20076","inReplyTo":"h3eqap$cov$1@ger.gmane.org","subject":"Re: Pushing to GitHub doesn't push all branches","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-07-13T11:01:15Z","receivedAt":"2009-07-13T11:01:15Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Graeme Geldenhuys venit, vidit, dixit 13.07.2009 10:12:\n> Michael J Gruber wrote:\n>> git config remote.origin.push '+refs/remotes/*:refs/heads/*'\n> \n> OK, I've done this, but I'm not 100% sure what this means. This is what \n> I think (from reading various git help and users guide). Any branches I \n> have which track remote references (from svn repository) will be pushed \n> to github as various head references (normal branches).  Is this correct?\n\nYes, any ref you have that matches the pattern refs/remotes/* (all your\nremote branches) is pushed to a ref named refs/heads/* in the repo (i.e.\na branch). The + means that non-fast-forward pushes are OK.\n\n> On our server, which contain the svn cloned repository and the one that \n> is only used for syncing svn -> our server -> github, I had to add a new \n> commit which represents the svn-ignore meta data to a .gitignore file. I \n> noticed I had to manually to a 'git checkout master' & 'git merge \n> remotes/trunk' to pull in new updates. I thin pushed that to github.\n\nYou didn't tell us *that* before... Exactly this is why I asked whether\nyou want to do own work on those branches or just push a git-svn mirror.\n\nI'm not sure adding .gitignore in a commit is a good idea, if that is\nthe only change you will make to the original branches. It keeps you\nfrom doing a simple fetch and forces you to set up merging.\n\nAlso, svn-metadata may change over time. Do you intend to keep\n.gitignore up to date with those changes?\n\n> So what is my twice hourly cron script supposed to look like? Is the \n> following still ok?\n> \n> ========[ script executed by cron every 30 minutes ]============\n> #!/bin/sh\n> GIT=\"/usr/local/bin/git\"\n> \n> # FPC repository\n> cd /mnt/samba/git/fpc.git/\n> $GIT checkout master\n> $GIT svn fetch\n> $GIT gc --auto\n> $GIT push github master\n> ==============================\n> \n> Or do I need to add a new line after '$GIT svn fetch' that does a merge.\n> \n> ==============================\n> $GIT svn fetch\n> $GIT merge remotes/trunk\n> ...\n> push to github\n> ==============================\n> \n> \n> Also what do I do with the other branch I want to track. It's called \n> remotes/fixes_2_2.\n> \n> I believe I need to first create a local branch.\n> \n>    git branch --track fixes_2_2 remotes/fixes_2_2\n> \n> What do I need to modify in my cron script to keep both the master & \n> fixes_2_2 branches in sync with SubVersion and push both to GitHub. I \n> want Github to show two branches: master & fixes_2_2\n\nWell, the way you used push you completely ignored the suggested\nrefspec. You pushed master into a matching ref (master). master may have\nhappened to be trunk before you added .gitignore (git-svn does not\nguarantee that).\n\nSo, there are two options:\n\n- Push the git-svn converted branches as is, using the suggested refspec\n(or having it in config and doing \"git push github\"). \"git svn fetch\"\nwill have fetched all svn refs you need.\n\n- Set up local branches and do your merge thing. In this case you\nprobably also want to keep up with svn metadata changes (mind that\nignore properties may depend on the branch as well). Done right this is\nnice, but of course it may be a bit more fragile.\n\nIn the first case you would need to distribute .gitignore in a different\nway. You could set up a separate branch (say svnhelper) for that which\nconsists of .gitignore (and possibly other things) only. \"git show\nsvnhelper:.gitignore > .git/info/excludes\" will set up each user. You\ncan also use a tag for that (i.e. instead of a branch).\n\nCheers,\nMichael\n"},{"id":"117907","messageId":"h3fdjg$770$1@ger.gmane.org","threadId":"20076","inReplyTo":"4A5B13FB.4040203@drmicha.warpmail.net","subject":"Re: Pushing to GitHub doesn't push all branches","fromName":"Graeme Geldenhuys","fromEmail":"graemeg@gmail.com","sentAt":"2009-07-13T13:41:11Z","receivedAt":"2009-07-13T13:41:11Z","isPatch":false,"sender":{"key":"graemeg@gmail.com","avatar":"https://gravatar.com/avatar/fdaae0cf0a07bd33782720fb37ae0450f504d4e04c57c6e8f3517d11d503fdc6?d=mp&s=160"},"body":"Michael J Gruber wrote:\n>> is only used for syncing svn -> our server -> github, I had to add a new \n>> commit which represents the svn-ignore meta data to a .gitignore file. I \n>> noticed I had to manually to a 'git checkout master' & 'git merge \n>> remotes/trunk' to pull in new updates. I thin pushed that to github.\n> \n> You didn't tell us *that* before... Exactly this is why I asked whether\n> you want to do own work on those branches or just push a git-svn mirror.\n\nWhen we last spoke, I did not have a .gitignore file. :)\nThat is the only change I plan to make in that repository (on our server).\n\nI have cloned that repository (on our server) to my local PC. The one on \nmy PC is a true Git repository and that is the one I'll be making \nchanges to and emailing patches back to the FPC mailing list.\n\n\n> the only change you will make to the original branches. It keeps you\n> from doing a simple fetch and forces you to set up merging.\n\nOK, so seeing that I already done that and pushed it to GitHub, I now \nneed to always do the following on our server git repository.\n\n  $ git svn fetch\n  $ git checkout master\n  $ git merge origin/trunk\n  $ git push github            <-- updates remotes/* to heads/*\n  $ git push github master     <-- updates remote master branch\n\n\nSo 'git push github' as I have show above should do the trick for all \nrefts/remotes/* branches. I gather that excludes the \"master\" branch, so \nI still need to push that one manually as well. Correct?\n\nIn the newer Git v1.6.x versions there is a new default setting that can \nbe set for push.\n\n   $ git config push.default <type>\n\nIf I set that to \"matching\", then I should be able to only need one 'git \npush github' command, and that should push remotes/* and the \"master\" \nbranch. Correct?\n\nIn my local repository on my work PC (not the server), I normally set \nthe push.default to \"current\" so I don't accidentally push something \nthat has an incomplete feature.\n\n\n> Also, svn-metadata may change over time. Do you intend to keep\n> .gitignore up to date with those changes?\n\nNo, just the initial setup.\n\n\n\n> - Push the git-svn converted branches as is, using the suggested refspec\n> (or having it in config and doing \"git push github\"). \"git svn fetch\"\n> will have fetched all svn refs you need.\n\nOK, I haven't added a .gitignore to the fixes_2_2 local branch, so that \none is still exactly as it was in SubVersion. And my local \"fixes_2_2\" \nhas not been pushed to Github yet. So I should be able to just delete \nthe local \"fixes_2_2\" branch. The normal refspec will push changes to \nGithub as it should. So if anybody clones the Github repository, they \ncan manually create their local \"fixes_2_2\" from the \nrefs/remotes/fixes_2_2 branch. Correct?\n\n\nI think I'm starting to see a little white light in the end of the \ntunnel. :-)\n\n\n> - Set up local branches and do your merge thing. In this case you\n> probably also want to keep up with svn metadata changes (mind that\n\nI think I will leave the local \"master\" branch (mapped to SubVersion \nTrunk) as-is. I'll then modify my cron script to do a manual merge after \nthe 'git svn fetch'.\n\nI'm not going to bother updating the .gitignore again. So from now \nonwards the merge should be a simple fast-forward merge I take it and \nshould never get conflicts again.\n\n\n> consists of .gitignore (and possibly other things) only. \"git show\n> svnhelper:.gitignore > .git/info/excludes\" will set up each user. You\n> can also use a tag for that (i.e. instead of a branch).\n\nVery clever indeed - pity I did not think of it before. I'll make a note \nof this and if I ever clone another SubVersion repository, I'll do it \nwith a tag or separate branch.\n\n\n\nRegards,\n   - Graeme -\n\n-- \nfpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal\nhttp://opensoft.homeip.net/fpgui/\n"}]}