{"thread":{"id":"20198","subject":"Newbie: Branch management","startedAt":"2009-07-22T20:41:04Z","lastAt":"2009-07-23T05:39:06Z","messageCount":4,"participants":["Dr. Jennifer Nussbaum","Allan Kelly","Allen Johnson","Tim Harper"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"118482","messageId":"446739.83600.qm@web53410.mail.re2.yahoo.com","threadId":"20198","inReplyTo":null,"subject":"Newbie: Branch management","fromName":"Dr. Jennifer Nussbaum","fromEmail":"bg271828@yahoo.com","sentAt":"2009-07-22T20:41:04Z","receivedAt":"2009-07-22T20:41:04Z","isPatch":false,"sender":{"key":"bg271828@yahoo.com","avatar":null},"body":"\nHi,\n\nI hope its OK to ask basic questions on this list.\n\nIm a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.\n\nI have a remote repository on my production server that serves as the \"main\" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ... \n\nI've found it very confusing dealing with branches in this environment. If I have my \"master\" branch, and decide that i want a \"refactoring-templates\" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say \"git push\" I want everything that's new on that computer to be synced to the \"main\" repository. And then when I get to the next computer, I want to be able to say \"git pull\" and have everything on that computer by synced *from* the \"main\" repository.\n\nInstead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.\n\nI've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?\n\nThanks!\n\nJen\n\n\n      \n"},{"id":"118495","messageId":"9586f3420907221445k2a8592d2ifacba57f3519f113@mail.gmail.com","threadId":"20198","inReplyTo":"446739.83600.qm@web53410.mail.re2.yahoo.com","subject":"Re: Newbie: Branch management","fromName":"Allan Kelly","fromEmail":"allankelly@gmail.com","sentAt":"2009-07-22T21:45:51Z","receivedAt":"2009-07-22T21:45:51Z","isPatch":false,"sender":{"key":"allankelly@gmail.com","avatar":"https://gravatar.com/avatar/c62021c01204c1e0c91084a96d4c16f19d394d3e67f6f51c707686da1d59cb64?d=mp&s=160"},"body":"Hi Jennifer,\n\nLike you I'm quite a new git user so I doubt I can entirely solve your\nproblem. However reading your mail, I recall my own initial confusion.\nLike you, I maintain a main server and various work desktops.\nEssentially I want my work status/environment replicated on-demand\naround these desktops, with the server as the synch-point. Sounds like\nyou.\n\nMy observation is that the granularity of git which makes it very\nmalleable, is a problem when you want to do \"broad brush\" things like\nthis (and this is the typical Unix \"feature-not-a-bug!\"). So, I think\nyou need to write a few wee scripts as I have done.\n\nI've set up very small scripts to execute a sequence of local and\nssh-based remote commands to sync things as I expect. For example,\n'git add .;git commit -a -m \"$MSG\"; git push;' is fine but the files\nin the origin server directory are out of sync for subsequent\nprocessing & upload to the web site. This confused me a _lot_. So I\nneed 'ssh server_name \"cd $SERVER_DIR && git checkout -f\"'. Now the\nserver dir has the same content as my working dir.\n\nI always call this script 'publish' and have an appropriate version in\nthe root of each of my working repos (the post-git compile/upload\nstage differs). Then in vim I routinely execute ':./publish <project>\n<commit msg> <upload Y/N>' from wherever I'm working.\n\nIf you want my (very simple!) 'publish' code then drop me a line. It\nmay give you a start.\n\nHTH!\n\nCheers, al.\n\n2009/7/22 Dr. Jennifer Nussbaum <bg271828@yahoo.com>:\n>\n> Hi,\n>\n> I hope its OK to ask basic questions on this list.\n>\n> Im a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.\n>\n> I have a remote repository on my production server that serves as the \"main\" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ...\n>\n> I've found it very confusing dealing with branches in this environment. If I have my \"master\" branch, and decide that i want a \"refactoring-templates\" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say \"git push\" I want everything that's new on that computer to be synced to the \"main\" repository. And then when I get to the next computer, I want to be able to say \"git pull\" and have everything on that computer by synced *from* the \"main\" repository.\n>\n> Instead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.\n>\n> I've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?\n>\n> Thanks!\n>\n> Jen\n>\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"118536","messageId":"6786ed4f0907222015w709475e9ke76b52606ebafac9@mail.gmail.com","threadId":"20198","inReplyTo":"9586f3420907221445k2a8592d2ifacba57f3519f113@mail.gmail.com","subject":"Re: Newbie: Branch management","fromName":"Allen Johnson","fromEmail":"akjohnson78@gmail.com","sentAt":"2009-07-23T03:15:10Z","receivedAt":"2009-07-23T03:15:10Z","isPatch":false,"sender":{"key":"akjohnson78@gmail.com","avatar":null},"body":"This might work as well. I'm assuming all repositories were cloned\ndirectly from your central (master) repository. Pushing with the\nfollowing option should work for you:\n\n$ git push --all\n\nAssuming we are on the laptop repository:\n\n$ git checkout -b laptopstuff\n$ ... edit and commits ...\n$ git push --all\n\nThat will push everything on your laptop repo to the central\nrepository. Then next time you pull from any of the other repositories\nthat were cloned from the central repository you'll see a remote\ntracking branch for laptopstuff.\n\nAssuming we are on the workstation now:\n\n$ git pull\n$ git branch -r\n\nYou should now see origin/laptopstuff in the list.\n\nHope that helps.\n\nAllen\n\nOn Wed, Jul 22, 2009 at 5:45 PM, Allan Kelly<allankelly@gmail.com> wrote:\n> Hi Jennifer,\n>\n> Like you I'm quite a new git user so I doubt I can entirely solve your\n> problem. However reading your mail, I recall my own initial confusion.\n> Like you, I maintain a main server and various work desktops.\n> Essentially I want my work status/environment replicated on-demand\n> around these desktops, with the server as the synch-point. Sounds like\n> you.\n>\n> My observation is that the granularity of git which makes it very\n> malleable, is a problem when you want to do \"broad brush\" things like\n> this (and this is the typical Unix \"feature-not-a-bug!\"). So, I think\n> you need to write a few wee scripts as I have done.\n>\n> I've set up very small scripts to execute a sequence of local and\n> ssh-based remote commands to sync things as I expect. For example,\n> 'git add .;git commit -a -m \"$MSG\"; git push;' is fine but the files\n> in the origin server directory are out of sync for subsequent\n> processing & upload to the web site. This confused me a _lot_. So I\n> need 'ssh server_name \"cd $SERVER_DIR && git checkout -f\"'. Now the\n> server dir has the same content as my working dir.\n>\n> I always call this script 'publish' and have an appropriate version in\n> the root of each of my working repos (the post-git compile/upload\n> stage differs). Then in vim I routinely execute ':./publish <project>\n> <commit msg> <upload Y/N>' from wherever I'm working.\n>\n> If you want my (very simple!) 'publish' code then drop me a line. It\n> may give you a start.\n>\n> HTH!\n>\n> Cheers, al.\n>\n> 2009/7/22 Dr. Jennifer Nussbaum <bg271828@yahoo.com>:\n>>\n>> Hi,\n>>\n>> I hope its OK to ask basic questions on this list.\n>>\n>> Im a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.\n>>\n>> I have a remote repository on my production server that serves as the \"main\" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ...\n>>\n>> I've found it very confusing dealing with branches in this environment. If I have my \"master\" branch, and decide that i want a \"refactoring-templates\" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say \"git push\" I want everything that's new on that computer to be synced to the \"main\" repository. And then when I get to the next computer, I want to be able to say \"git pull\" and have everything on that computer by synced *from* the \"main\" repository.\n>>\n>> Instead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.\n>>\n>> I've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?\n>>\n>> Thanks!\n>>\n>> Jen\n>>\n>>\n>>\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"118554","messageId":"e1a5e9a00907222239o1d75c163ia007a3cc370e31a3@mail.gmail.com","threadId":"20198","inReplyTo":"446739.83600.qm@web53410.mail.re2.yahoo.com","subject":"Re: Newbie: Branch management","fromName":"Tim Harper","fromEmail":"timcharper@gmail.com","sentAt":"2009-07-23T05:39:06Z","receivedAt":"2009-07-23T05:39:06Z","isPatch":false,"sender":{"key":"timcharper@gmail.com","avatar":"https://gravatar.com/avatar/1a2e0c06c7862ff065ee6b1d53195333a5a0577c040ecb2856a150d8e0b00ecd?d=mp&s=160"},"body":"On Wed, Jul 22, 2009 at 2:41 PM, Dr. Jennifer\nNussbaum<bg271828@yahoo.com> wrote:\n>\n> Hi,\n>\n> I hope its OK to ask basic questions on this list.\n>\n> Im a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.\n>\n> I have a remote repository on my production server that serves as the \"main\" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ...\n>\n> I've found it very confusing dealing with branches in this environment. If I have my \"master\" branch, and decide that i want a \"refactoring-templates\" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say \"git push\" I want everything that's new on that computer to be synced to the \"main\" repository. And then when I get to the next computer, I want to be able to say \"git pull\" and have everything on that computer by synced *from* the \"main\" repository.\n>\n> Instead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.\n>\n> I've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?\n>\n> Thanks!\n>\n> Jen\n\nI was turned off about this at first when I used git - I was in SVN\nmode still and wanted all my local branches to be synchronized with\nthe remote repository.  A year and a half later, I'm glad that the\nminds behind git didn't set out to make git like SVN!  I really think\nthis was the right decision.  For instance... if you pulled ALL of\nyour branches in one command... what if there were conflicts?  I doubt\nyou'd want to resolve them right then and there.\n\nAnyways... 'git fetch' will download all the changes from the remote\nrepository.  From there, you can simply merge any remote branch\nlocally (ie, 'git merge origin/master' while in the master branch).\n\nEnjoy the journey!\n\nTim\n"}]}