{"thread":{"id":"22365","subject":"basic question about push","startedAt":"2010-01-24T07:04:59Z","lastAt":"2010-01-25T11:08:13Z","messageCount":6,"participants":["Russ Paielli","Jeff King","Junio C Hamano","Jay Soffian"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"132525","messageId":"loom.20100124T074722-510@post.gmane.org","threadId":"22365","inReplyTo":null,"subject":"basic question about push","fromName":"Russ Paielli","fromEmail":"russ.paielli@gmail.com","sentAt":"2010-01-24T07:04:59Z","receivedAt":"2010-01-24T07:04:59Z","isPatch":false,"sender":{"key":"russ.paielli@gmail.com","avatar":null},"body":"I am just starting to learn git. I would like to start by using git to work\nremotely. My work computer and home computer both run Linux. I can log into my\nwork computer from home, but not vice versa. For several years, I have been\nusing ssh (with X forwarding) to login to my work computer from home. I have\nbeen basically using my home computer as an X terminal. I would like to start\nactually working locally on my home computer and use git to stay sync'd with my\nwork computer.\n\nI created a git repository on my work machine, and I cloned it on my home\nmachine. As a test, I edited a file on my home machine and pushed it to my work\nmachine. I guess I don't understand how to use push. I got this:\n\nCounting objects: 5, done.    \nCompressing objects: 100% (2/2), done.\nWriting objects: 100% (3/3), 278 bytes, done.\nTotal 3 (delta 1), reused 0 (delta 0)        \nwarning: updating the current branch         \nwarning: Updating the currently checked out branch may cause confusion,\nwarning: as the index and work tree do not reflect changes that are in HEAD.\nwarning: As a result, you may see the changes you just pushed into it       \nwarning: reverted when you run 'git diff' over there, and you may want      \nwarning: to run 'git reset --hard' before starting to work to recover.      \nwarning:                                                                    \nwarning: You can set 'receive.denyCurrentBranch' configuration variable to  \nwarning: 'refuse' in the remote repository to forbid pushing into its       \nwarning: current branch.                                                    \nwarning: To allow pushing into the current branch, you can set it to 'ignore';\nwarning: but this is not recommended unless you arranged to update its work   \nwarning: tree to match what you pushed in some other way.                     \nwarning:                                                                      \nwarning: To squelch this message, you can set it to 'warn'.                   \nwarning:                                                                      \nwarning: Note that the default will change in a future version of git         \nwarning: to refuse updating the current branch unless you have the            \nwarning: configuration variable set to either 'ignore' or 'warn'.             \nTo ssh://localhost:6666/home/paielli/scala                                    \n   7ea65c7..c52864c  master -> master\n\n\nWhat does this mean in English? And what is the correct way to transfer my\nrevisions from my home computer to my work computer? Thanks.\n\nRuss P.\n"},{"id":"132527","messageId":"20100124081513.GA10700@coredump.intra.peff.net","threadId":"22365","inReplyTo":"loom.20100124T074722-510@post.gmane.org","subject":"Re: basic question about push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-24T08:15:14Z","receivedAt":"2010-01-24T08:15:14Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 24, 2010 at 07:04:59AM +0000, Russ Paielli wrote:\n\n> warning: updating the current branch         \n> [...]\n> What does this mean in English? And what is the correct way to transfer my\n> revisions from my home computer to my work computer? Thanks.\n\nIt means your workflow will cause problems as the pusher magically\nchanges your repository's concept of \"the latest commit\" behind the\npushee's back. The workflow you want is described here:\n\n  http://git.wiki.kernel.org/index.php/GitFaq#push-is-reverse-of-fetch\n\n-Peff\n"},{"id":"132552","messageId":"7vzl43723t.fsf@alter.siamese.dyndns.org","threadId":"22365","inReplyTo":"20100124081513.GA10700@coredump.intra.peff.net","subject":"Re: basic question about push","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-24T19:08:06Z","receivedAt":"2010-01-24T19:08:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Sun, Jan 24, 2010 at 07:04:59AM +0000, Russ Paielli wrote:\n>\n>> warning: updating the current branch         \n>> [...]\n>> What does this mean in English? And what is the correct way to transfer my\n>> revisions from my home computer to my work computer? Thanks.\n>\n> It means your workflow will cause problems as the pusher magically\n> changes your repository's concept of \"the latest commit\" behind the\n> pushee's back. The workflow you want is described here:\n>\n>   http://git.wiki.kernel.org/index.php/GitFaq#push-is-reverse-of-fetch\n\nI saw somebody referred to this entry and refused to study the entry\nimmediately after seeing the word \"firewalled\", saying \"my environment is\nnot firewalled\", without trying to judge if the description applies to his\ncase.  This was understandable; the workflow will apply in non-firewalled\ncase just as well, even though \"firewalled\" case may be the easiest to see\nwhy it is recommended.\n\nPerhaps the title of the entry needs to be rewritten to clarify that this\nis not _limited_ to a firewalled situation?\n"},{"id":"132568","messageId":"76718491001241559u103d2e8j38687b41bd5401a1@mail.gmail.com","threadId":"22365","inReplyTo":"20100124081513.GA10700@coredump.intra.peff.net","subject":"Re: basic question about push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-01-24T23:59:10Z","receivedAt":"2010-01-24T23:59:10Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Sun, Jan 24, 2010 at 3:15 AM, Jeff King <peff@peff.net> wrote:\n> On Sun, Jan 24, 2010 at 07:04:59AM +0000, Russ Paielli wrote:\n>\n>> warning: updating the current branch\n>> [...]\n>> What does this mean in English? And what is the correct way to transfer my\n>> revisions from my home computer to my work computer? Thanks.\n>\n> It means your workflow will cause problems as the pusher magically\n> changes your repository's concept of \"the latest commit\" behind the\n> pushee's back. The workflow you want is described here:\n>\n>  http://git.wiki.kernel.org/index.php/GitFaq#push-is-reverse-of-fetch\n\nAside, and I think we've discussed this before, but I wonder if it\nwould make sense to:\n\na) Add an option to clone such as \"-p [<name>] | --push-as[=<name>]\"\nwhere <name> defaults to $(uname -n | cut -f1 -d.) This would setup\nthe cloned repo with a push refspec\n\"+refs/heads/*:refs/remotes/<name>/*\". e.g.:\n\n$ git clone -o host1 -p host2 ssh://host1/~/repo.git\n$ cat repo/.git/config\n...\n[remote \"host1\"]\n\turl = ssh://host1/~/repo.git\n\tfetch = +refs/heads/*:refs/remotes/host1/*\n\tpush = +refs/heads/*:refs/remotes/host2/*\n\nb) The controversial part: make this option the default the default\nwhen cloning from a non-bare repo. There would need to be some way to\nturn it off.\n\nOf course, I'm not sure this would be any less confusing for users.\nWould they wonder why they have to merge to see their pushed changes\nreflected on the pushed-to repo?\n\nIt does nicely make push symmetric to fetch between two non-bare repos\nthough, and I think maybe that makes more sense.\n\nj.\n"},{"id":"132589","messageId":"20100125110023.GA8517@coredump.intra.peff.net","threadId":"22365","inReplyTo":"7vzl43723t.fsf@alter.siamese.dyndns.org","subject":"Re: basic question about push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-25T11:00:23Z","receivedAt":"2010-01-25T11:00:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 24, 2010 at 11:08:06AM -0800, Junio C Hamano wrote:\n\n> >   http://git.wiki.kernel.org/index.php/GitFaq#push-is-reverse-of-fetch\n> \n> I saw somebody referred to this entry and refused to study the entry\n> immediately after seeing the word \"firewalled\", saying \"my environment is\n> not firewalled\", without trying to judge if the description applies to his\n> case.  This was understandable; the workflow will apply in non-firewalled\n> case just as well, even though \"firewalled\" case may be the easiest to see\n> why it is recommended.\n> \n> Perhaps the title of the entry needs to be rewritten to clarify that this\n> is not _limited_ to a firewalled situation?\n\nI agree, and just tweaked the title and text a bit. After doing that, I\nrealized that you had already done so a few hours ago, too. :) So\nbetween the two of us, hopefully it is better.\n\n-Peff\n"},{"id":"132593","messageId":"20100125110813.GB8517@coredump.intra.peff.net","threadId":"22365","inReplyTo":"76718491001241559u103d2e8j38687b41bd5401a1@mail.gmail.com","subject":"Re: basic question about push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-25T11:08:13Z","receivedAt":"2010-01-25T11:08:13Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 24, 2010 at 06:59:10PM -0500, Jay Soffian wrote:\n\n> >  http://git.wiki.kernel.org/index.php/GitFaq#push-is-reverse-of-fetch\n> \n> Aside, and I think we've discussed this before, but I wonder if it\n> would make sense to:\n> \n> a) Add an option to clone such as \"-p [<name>] | --push-as[=<name>]\"\n> where <name> defaults to $(uname -n | cut -f1 -d.) This would setup\n> the cloned repo with a push refspec\n> \"+refs/heads/*:refs/remotes/<name>/*\". e.g.:\n> \n> $ git clone -o host1 -p host2 ssh://host1/~/repo.git\n> $ cat repo/.git/config\n> ...\n> [remote \"host1\"]\n> \turl = ssh://host1/~/repo.git\n> \tfetch = +refs/heads/*:refs/remotes/host1/*\n> \tpush = +refs/heads/*:refs/remotes/host2/*\n\nOne problem with this scheme is that it actually does two things:\n\n  1. Tells git to push into the refs/remotes/host2/ hierarchy instead of\n     refs/heads/.\n\n  2. Overrides matching behavior to push all heads.\n\nPoint (2) is less of a problem than it is without (1) in the sense that\nyou are pushing to a unique namespace, so you don't have to worry as\nmuch about your crappy half-finished branches filling up the main branch\nnamespace. But you might not want them publicized at all, either because\nthey are embarrassingly bad or simply because it is cruft that you will\nencounter later and wonder \"is this branch, which is missing from my\nlocal repositor (presumably from a long-ago deletion) but present\nupstream of any value at all?\"\n\nI can't think offhand of a way to get the behavior of (1) without (2).\nI know we have a shorthand refspec for \"matching\", but this would not\nstrictly be matching. It is \"convert refs/heads/X into\nrefs/remotes/blah/X, and _then_ match\".\n\nIf we had a refspec that worked in that manner, I would think it's a\npretty good idea (even to turn it on by default for non-bare repos).\n\n> b) The controversial part: make this option the default the default\n> when cloning from a non-bare repo. There would need to be some way to\n> turn it off.\n\nHmm. Do we reliably know from the client side whether a remote is bare\nor not?\n\n> Of course, I'm not sure this would be any less confusing for users.\n> Would they wonder why they have to merge to see their pushed changes\n> reflected on the pushed-to repo?\n\nYes, I think we would still have the FAQ of \"I pushed my changes, where\ndid they go?\" but at least the answer would be \"git merge foo\" and not\n\"what you are doing is confusing to git and you need to figure out what\nkind of workflow you want, redo your push, and then git merge foo\".\nWhich seems like an improvement to me. ;)\n\n-Peff\n"}]}