{"thread":{"id":"9272","subject":"Newbie problem","startedAt":"2007-07-28T07:20:22Z","lastAt":"2007-07-28T08:50:04Z","messageCount":3,"participants":["Insitu","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"48875","messageId":"87vec5vvt5.fsf@osquare.oqube.com","threadId":"9272","inReplyTo":null,"subject":"Newbie problem","fromName":"Insitu","fromEmail":"abailly@oqube.com","sentAt":"2007-07-28T07:20:22Z","receivedAt":"2007-07-28T07:20:22Z","isPatch":false,"sender":{"key":"abailly@oqube.com","avatar":null},"body":"Hello, \nI am new to git and gave it a try to version my home dir and\nsynchronize it between two machines. It works but I think I did some\nmistakes in my setup which make its usability non optimal: \n - push/pull operations need remote address\n - I didn't set up any branch\n\nHere is what I did (lap is for operations on laptop, pc on desktop):\nlap> git init\nlap> git add ...\nlap> git commit ...\nlap> scp .git pc:\nlap> mv .git git-init\npc> git checkout .\npc> git commit ...\nlap> git clone  -n --bare --reference git-init/  ssh://pc/~/.git\nlap> git checkout .\nlap> git add ...\nlap> git commit\n\nNow, I want to be able to do:\nlap> git push\nor\nlap> git pull\n\ninstead of \nlap> git push ssh://pc/~/.git\n\nI think I need to reconfigure my remote branches/origin on laptop but\ndon't want ot break everything.\n\nHelp appreciated,\n-- \nOQube < software engineering \\ génie logiciel >\nArnaud Bailly, Dr.\n\\web> http://www.oqube.com\n"},{"id":"48877","messageId":"7vmyxht0r6.fsf@assigned-by-dhcp.cox.net","threadId":"9272","inReplyTo":"87vec5vvt5.fsf@osquare.oqube.com","subject":"Re: Newbie problem","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-28T08:01:49Z","receivedAt":"2007-07-28T08:01:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Insitu <abailly@oqube.com> writes:\n\n> Now, I want to be able to do:\n> lap> git push\n> or\n> lap> git pull\n>\n> instead of \n> lap> git push ssh://pc/~/.git\n>\n> I think I need to reconfigure my remote branches/origin on laptop but\n> don't want ot break everything.\n\nThe necessary syntax and configuration files are all documented\nfairly detailed in the manual pages, but it is a tad hard to\nknow where to look:\n\n    http://www.kernel.org/pub/software/scm/git/docs/git-fetch.html\n    http://www.kernel.org/pub/software/scm/git/docs/git-push.html\n    http://www.kernel.org/pub/software/scm/git/docs/git-config.html\n\nIf you use recent enough git (post 1.5.0), the recommended way\nto keep two boxes in sync is:\n\nOn mothership box, in .git/config:\n\n [remote \"origin\"]\n     url = satellite:.git/\n     fetch = +refs/heads/*:refs/remotes/origin/*\n     push = refs/heads/*:refs/remotes/origin/*\n [branch \"master\"]\n     remote = origin\n     merge = refs/heads/master\n\nOn satellite laptop, in .git/config:\n\n [remote \"origin\"]\n     url = mothership:.git/\n     fetch = +refs/heads/*:refs/remotes/origin/*\n     push = refs/heads/*:refs/remotes/origin/*\n [branch \"master\"]\n     remote = origin\n     merge = refs/heads/master\n\nThen, whenever you start working on the satellite:\n\n\t$ git pull\n\nwhich, while you are on \"master\" branch, would use 'origin' as\nthe default remote (thanks to branch.master.remote configuration),\nstore the copy of mothership's branches in refs/remotes/origin/,\nand merges the \"master\" branch obtained from the mothership to\nyour \"master\" branch on the satellite [*1*].  \n\nWhen you are done working on the satellite:\n\n\t$ git push\n\nwill push to \"origin\" by default, which would push all your\nbranches (thanks to remote.origin.push configuration) to\nmothership's refs/remotes/origin/.\n\nWhen you go back to the mothership, your work done on the\nsatellite are already pushed into the refs/remote/origin/\ntracking branches, so you can merge them in (you can do this\nafter shutting down your satellite laptop, which is the beauty\nof this setup):\n\n\t$ git merge origin/master\n\nto merge in the changes you did on the satellite.\n\n\n[Footnote]\n\n*1* If you prefer to keep a straight history, you may want to\n    fetch+rebase instead of pull which is a fetch+merge, in\n    which case this step will be:\n\n\t$ git fetch\n        $ git rebase origin/master\n"},{"id":"48884","messageId":"87myxgx683.fsf@osquare.oqube.com","threadId":"9272","inReplyTo":"7vmyxht0r6.fsf@assigned-by-dhcp.cox.net","subject":"Re: Newbie problem","fromName":"Insitu","fromEmail":"abailly@oqube.com","sentAt":"2007-07-28T08:50:04Z","receivedAt":"2007-07-28T08:50:04Z","isPatch":false,"sender":{"key":"abailly@oqube.com","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>\n>  [remote \"origin\"]\n>      url = satellite:.git/\n>      fetch = +refs/heads/*:refs/remotes/origin/*\n>      push = refs/heads/*:refs/remotes/origin/*\n>  [branch \"master\"]\n>      remote = origin\n>      merge = refs/heads/master\n>\n> On satellite laptop, in .git/config:\n>\n>  [remote \"origin\"]\n>      url = mothership:.git/\n>      fetch = +refs/heads/*:refs/remotes/origin/*\n>      push = refs/heads/*:refs/remotes/origin/*\n>  [branch \"master\"]\n>      remote = origin\n>      merge = refs/heads/master\n>\n\nThanks a lot for all these details ! \n\nYes, I also find Git very well\ndocumented (maybe too much docuemented :) )  and could have come to\nthe settings with info from the various man pages. But much less\nquickly of course.\n\nMy question is: can I do this right now that my repositories are up\nand running ? \n\nRegards,\n-- \nOQube < software engineering \\ génie logiciel >\nArnaud Bailly, Dr.\n\\web> http://www.oqube.com\n"}]}