{"thread":{"id":"43874","subject":"Working from different machines.","startedAt":"2016-08-17T21:55:44Z","lastAt":"2016-08-19T01:37:03Z","messageCount":7,"participants":["Tobiah","Junio C Hamano","Jacob Keller","Jakub Narębski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"299580","messageId":"71d05705-792f-8bb9-026b-5b9251b104b9@tobiah.org","threadId":"43874","inReplyTo":null,"subject":"Working from different machines.","fromName":"Tobiah","fromEmail":"toby@tobiah.org","sentAt":"2016-08-17T21:47:45Z","receivedAt":"2016-08-17T21:55:44Z","isPatch":false,"sender":{"key":"toby@tobiah.org","avatar":null},"body":"Right now I have a server at work where I keep a bare repository as\na source and backup for projects.  So I clone a project from there\nto my desktop, and work, making a few branches as I try out ideas\nfor new features.\n\nThen I go home, and I want to work as though I was sitting at my\ndesktop.  If I clone the committed work, I don't get all my branches.\nHow can I work so that I now easily have all my branches, then after\nI work at home, when I go back to my desktop, the branches now reflect\nwhatever state I last left them in?\n\nIn other words, I want to work from different machines, and always\nsit down to the environment exactly as I last left it.\n\nThanks!\n\n\n\n"},{"id":"299583","messageId":"xmqq4m6j81ci.fsf@gitster.mtv.corp.google.com","threadId":"43874","inReplyTo":"71d05705-792f-8bb9-026b-5b9251b104b9@tobiah.org","subject":"Re: Working from different machines.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-17T22:41:49Z","receivedAt":"2016-08-17T22:42:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tobiah <toby@tobiah.org> writes:\n\n> In other words, I want to work from different machines, and always\n> sit down to the environment exactly as I last left it.\n\nYou have several options, but it depends on untold expectations you\nhave beyond \"exactly as I last left it.\"  So the following is only\nto show directions and possibilities without going into details.\n\nFor example, do you save all changes you made in your editor buffers\nbefore you leave the 'desktop'?  If the answer is \"no\", then that is\nnot a problem Git-the-tool is interested in solving, and the only\nsolution I could think of is to use mechanism to share the session\nbetween 'desktop' and 'home', using things like remote-desktop or\nscreen session.\n\nIf the answer is \"yes\", the next question is if you commit all the\nchanges you made before you leave the 'desktop'.  If the answer is\n\"no\", again, that is not a problem Git-the-tool is interested in\nsolving, and the only solution I could think of (in addition to the\n\"share the session\" above) is to use networked filesystem shared\nbetween 'desktop' and 'home'.\n\nIf the answer is \"yes\", then you are in the problem space that\nGit-the-tool is interested in solving.  Assuming that you have\nnetwork connection into 'desktop' from 'home', the solution would\ninvolve making it the first thing to do when get home to run \"git\nfetch\" on 'home' to get the latest state from the 'desktop', and run\n\"git push\" on 'home' to push out the latest state to the 'desktop'\nbefore you leave 'home'.  If your 'server' is for your sole use, and\nif 'home' has network connection into 'server', then you could\ninstead rendezvous at 'server' by running \"git push server\" on\n'desktop' (or 'home') to 'server' as the last thing before you leave\n'desktop' (or 'home'), and running \"git fetch server\" on 'home' (or\n'desktop') as the first thing before you start working on 'home' (or\n'desktop').\n\n\n\n\n"},{"id":"299594","messageId":"CA+P7+xpCWF9scST4bPYy61=6R8Givaw01DT7r4gOfk+shwWSYg@mail.gmail.com","threadId":"43874","inReplyTo":"xmqq4m6j81ci.fsf@gitster.mtv.corp.google.com","subject":"Re: Working from different machines.","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-08-18T06:10:17Z","receivedAt":"2016-08-18T06:10:55Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Wed, Aug 17, 2016 at 3:41 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> If the answer is \"yes\", then you are in the problem space that\n> Git-the-tool is interested in solving.  Assuming that you have\n> network connection into 'desktop' from 'home', the solution would\n> involve making it the first thing to do when get home to run \"git\n> fetch\" on 'home' to get the latest state from the 'desktop', and run\n> \"git push\" on 'home' to push out the latest state to the 'desktop'\n> before you leave 'home'.  If your 'server' is for your sole use, and\n> if 'home' has network connection into 'server', then you could\n> instead rendezvous at 'server' by running \"git push server\" on\n> 'desktop' (or 'home') to 'server' as the last thing before you leave\n> 'desktop' (or 'home'), and running \"git fetch server\" on 'home' (or\n> 'desktop') as the first thing before you start working on 'home' (or\n> 'desktop').\n>\n>\n\nTo add to this, you may need to modify the \"git push\" portion of the\nphases and the \"git fetch\" potion to include all the branches you are\ninterested in.\n\nThanks,\nJake\n"},{"id":"299604","messageId":"60d5e760-dbc9-121e-f003-a6971534cdcb@gmail.com","threadId":"43874","inReplyTo":"xmqq4m6j81ci.fsf@gitster.mtv.corp.google.com","subject":"Re: Working from different machines.","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2016-08-18T12:29:16Z","receivedAt":"2016-08-18T12:52:05Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"W dniu 18.08.2016 o 00:41, Junio C Hamano pisze:\n> Tobiah <toby@tobiah.org> writes:\n\n> [...] the next question is if you commit all the\n> changes you made before you leave the 'desktop'. [...]\n> \n> If the answer is \"yes\", then you are in the problem space that\n> Git-the-tool is interested in solving.  Assuming that you have\n> network connection into 'desktop' from 'home', the solution would\n> involve making it the first thing to do when get home to run \"git\n> fetch\" on 'home' to get the latest state from the 'desktop', and run\n> \"git push\" on 'home' to push out the latest state to the 'desktop'\n> before you leave 'home'.  If your 'server' is for your sole use, and\n> if 'home' has network connection into 'server', then you could\n> instead rendezvous at 'server' by running \"git push server\" on\n> 'desktop' (or 'home') to 'server' as the last thing before you leave\n> 'desktop' (or 'home'), and running \"git fetch server\" on 'home' (or\n> 'desktop') as the first thing before you start working on 'home' (or\n> 'desktop').\n\nTwo additional comments:\n\n* First, `--mirror` might be what the relation between 'desktop'\n  and 'home' repositories should be.\n\n* Second, even if you can connect only from 'home' to 'desktop',\n  but not from 'desktop' to 'home', the refspec mechanism of Git\n  is flexible enough that you can emulate 'push' with \n  appropriately configured 'fetch', and vice versa.\n\n-- \nJakub Narębski\n\n"},{"id":"299615","messageId":"4a154cc2-c3e2-65b7-4bdd-d7c41d700491@tobiah.org","threadId":"43874","inReplyTo":"60d5e760-dbc9-121e-f003-a6971534cdcb@gmail.com","subject":"Re: Working from different machines.","fromName":"Tobiah","fromEmail":"toby@tobiah.org","sentAt":"2016-08-18T14:28:58Z","receivedAt":"2016-08-18T14:29:14Z","isPatch":false,"sender":{"key":"toby@tobiah.org","avatar":null},"body":"\n>\n> * First, `--mirror` might be what the relation between 'desktop'\n>   and 'home' repositories should be.\n>\n\n\nHere's what I'm trying, am I in the right ballpark?\n\ndesk> git branch\n* master\ndesk> git checkout -b banana\nSwitched to a new branch 'banana'\ndesk> echo 'message' > oracle\ndesk> git add oracle\ndesk> git commit -a -moracle\n[banana 66e7823] oracle\n  1 file changed, 1 insertion(+)\n  create mode 100644 oracle\ndesk> git push --mirror\nCounting objects: 3, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (2/2), done.\nWriting objects: 100% (3/3), 260 bytes | 0 bytes/s, done.\nTotal 3 (delta 1), reused 0 (delta 0)\nTo toby@shells.rcsreg.com:/home/git/toby/exposmart\n  * [new branch]      banana -> banana\n\n# Then on another machine:\n\nhome> git branch\n* master\n## Forgot to 'pull' here, but it never shows new branches anyway\n## I have to get them by name.  Can I automate that?\n\nhome> git checkout banana\nBranch banana set up to track remote branch banana from origin.\nSwitched to a new branch 'banana'\nhome> cat oracle\nmessage\nhome> echo 'other message' >> oracle\nhome> git commit -a -moracle2\n[banana 78e6c45] oracle2\n  1 file changed, 1 insertion(+)\nhome> git push --mirror\nCounting objects: 36, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (22/22), done.\nWriting objects: 100% (36/36), 2.90 KiB | 0 bytes/s, done.\nTotal 36 (delta 13), reused 14 (delta 4)\nTo shells.rcsreg.com:/home/git/toby/exposmart\n    66e7823..78e6c45  banana -> banana\n    7e01bf8..c65ed75  origin/HEAD -> origin/HEAD\n  * [new branch]      origin/auto -> origin/auto\n  * [new branch]      origin/banana -> origin/banana\n  * [new branch]      origin/develop -> origin/develop\n  * [new branch]      origin/flipper -> origin/flipper\n  * [new branch]      origin/tart -> origin/tart\nhome> vi\nhome> git push --mirror\nTotal 0 (delta 0), reused 0 (delta 0)\nTo shells.rcsreg.com:/home/git/toby/exposmart\n    66e7823..78e6c45  origin/banana -> origin/banana\nhome> git push --mirror\nEverything up-to-date\nhome>\n\n## Why do I have to push three times to get the 'Everyting up-to-date'\n## message?  Why does it still mention 'flipper' and 'tart' and all\n## other branches I've played with.  When I delte them locally, I want\n## them to be deleted everywhere.  They just keep accumulating.\n##\n## Now back a the other machine\n\n\ndesk> git pull\nremote: Counting objects: 5, done.\nremote: Compressing objects: 100% (2/2), done.\nremote: Total 3 (delta 1), reused 0 (delta 0)\nUnpacking objects: 100% (3/3), done.\n From shells.rcsreg.com:/home/git/toby/exposmart\n    66e7823..78e6c45  banana     -> origin/banana\nThere is no tracking information for the current branch.\nPlease specify which branch you want to merge with.\nSee git-pull(1) for details.\n\n     git pull <remote> <branch>\n\nIf you wish to set tracking information for this branch you can do so with:\n\n     git branch --set-upstream-to=origin/<branch> banana\n\ndesk> git branch\n* banana\n   master\ndesk> git pull origin banana\n From shells.rcsreg.com:/home/git/toby/exposmart\n  * branch            banana     -> FETCH_HEAD\nUpdating 66e7823..78e6c45\nFast-forward\n  oracle | 1 +\n  1 file changed, 1 insertion(+)\ndesk> cat oracle\nmessage\nother message\n\n\n## So it seems to have worked, but the more I go back and forth\n## The more I seem to have eventual problems getting branches\n## and changes.  Am I doing it right?\n\n\nThanks\n\n\n\n"},{"id":"299616","messageId":"c374f742-bc42-fdb5-37e8-f795a14259a2@tobiah.org","threadId":"43874","inReplyTo":"xmqq4m6j81ci.fsf@gitster.mtv.corp.google.com","subject":"Re: Working from different machines.","fromName":"Tobiah","fromEmail":"toby@tobiah.org","sentAt":"2016-08-18T14:11:51Z","receivedAt":"2016-08-18T14:44:06Z","isPatch":false,"sender":{"key":"toby@tobiah.org","avatar":null},"body":"On 08/17/2016 03:41 PM, Junio C Hamano wrote:\n> Tobiah <toby@tobiah.org> writes:\n>\n>> In other words, I want to work from different machines, and always\n>> sit down to the environment exactly as I last left it.\n>\n> You have several options, but it depends on untold expectations you\n> have beyond \"exactly as I last left it.\"  So the following is only\n> to show directions and possibilities without going into details.\n>\n> For example, do you save all changes you made in your editor buffers\n> before you leave the 'desktop'?  If the answer is \"no\", then that is\n> not a problem Git-the-tool is interested in solving, and the only\n> solution I could think of is to use mechanism to share the session\n> between 'desktop' and 'home', using things like remote-desktop or\n> screen session.\n>\n> If the answer is \"yes\", the next question is if you commit all the\n> changes you made before you leave the 'desktop'.  If the answer is\n> \"no\", again, that is not a problem Git-the-tool is interested in\n> solving, and the only solution I could think of (in addition to the\n> \"share the session\" above) is to use networked filesystem shared\n> between 'desktop' and 'home'.\n>\n> If the answer is \"yes\", then you are in the problem space that\n> Git-the-tool is interested in solving.  Assuming that you have\n> network connection into 'desktop' from 'home', the solution would\n> involve making it the first thing to do when get home to run \"git\n> fetch\" on 'home' to get the latest state from the 'desktop', and run\n> \"git push\" on 'home' to push out the latest state to the 'desktop'\n> before you leave 'home'.  If your 'server' is for your sole use, and\n> if 'home' has network connection into 'server', then you could\n> instead rendezvous at 'server' by running \"git push server\" on\n> 'desktop' (or 'home') to 'server' as the last thing before you leave\n> 'desktop' (or 'home'), and running \"git fetch server\" on 'home' (or\n> 'desktop') as the first thing before you start working on 'home' (or\n> 'desktop').\n>\n\nI've done a poor job of expressing my need.  I'm only\nspeaking about the state of each git project directory.\nShared sessions or filesystems are not what I'm loolking\nfor.\n\nAs far as the master branch goes, I have no problem syncing\neverything to the server, then pulling to a different\nmachine.  When I said I want everything to be the same\nbetween the home and work machines, I meant with regard to\nall of the other branches.  I want to easily create an\nentire movable git environment that is indistinguishable\nfrom machine to machine.\n\nIt looks like --mirror is close to what I am looking for.\n\nThanks\n"},{"id":"299655","messageId":"0346c307-931d-a7b2-7179-9c75b16bace4@gmail.com","threadId":"43874","inReplyTo":"4a154cc2-c3e2-65b7-4bdd-d7c41d700491@tobiah.org","subject":"Re: Working from different machines.","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2016-08-18T16:53:21Z","receivedAt":"2016-08-19T01:37:03Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"W dniu 18.08.2016 o 16:28, Tobiah pisze:\n\n> ## [...]  Why does it still mention 'flipper' and 'tart' and all\n> ## other branches I've played with.  When I delte them locally, I want\n> ## them to be deleted everywhere.  They just keep accumulating.\n\nIn case of non-mirror setup. Git wouldn't delete remote-tracking branches\n(e.g. origin/tart) if branch in remote repository is deleted (e.g. tart\nin origin repository); you need to prune (or set up to auto prune), e.g.\n\n $ git remote origin prune\n\n-- \nJakub Narębski\n\n"}]}