{"thread":{"id":"14248","subject":"git push requires a subsequent git reset --hard ?","startedAt":"2008-07-01T16:51:26Z","lastAt":"2008-07-04T13:25:57Z","messageCount":6,"participants":["Neshama Parhoti","Jeff King","Jakub Narebski","Dmitry Potapov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"81892","messageId":"912ec82a0807010951j9e970f2k9624682b33c8af7d@mail.gmail.com","threadId":"14248","inReplyTo":null,"subject":"git push requires a subsequent git reset --hard ?","fromName":"Neshama Parhoti","fromEmail":"pneshama@gmail.com","sentAt":"2008-07-01T16:51:26Z","receivedAt":"2008-07-01T16:51:26Z","isPatch":false,"sender":{"key":"pneshama@gmail.com","avatar":null},"body":"Hi all,\n\nI took with me a copy of a local repository to a week away from my station\n(just rsync'ed it to my laptop).\n\nOn my return, I just \"git push myuser@my-station:/my/git/repo\" from my laptop.\nIt seemed to work with no probs.\nOn my station the git repo got the new commits, as I can see in\ngit-log, but the actual files were left untouched.\n\nSo I need to do something like \"git reset --hard HEAD\" to get\nthe changes into the local files.\n\nIs that considered normal ?\n\nor did I do something wrong ?\n\nThanks,\npnesh\n"},{"id":"81894","messageId":"20080701171913.GA8911@sigill.intra.peff.net","threadId":"14248","inReplyTo":"912ec82a0807010951j9e970f2k9624682b33c8af7d@mail.gmail.com","subject":"Re: git push requires a subsequent git reset --hard ?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-07-01T17:19:13Z","receivedAt":"2008-07-01T17:19:13Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 01, 2008 at 07:51:26PM +0300, Neshama Parhoti wrote:\n\n> On my return, I just \"git push myuser@my-station:/my/git/repo\" from my laptop.\n> It seemed to work with no probs.\n> On my station the git repo got the new commits, as I can see in\n> git-log, but the actual files were left untouched.\n> \n> So I need to do something like \"git reset --hard HEAD\" to get\n> the changes into the local files.\n> \n> Is that considered normal ?\n> \n> or did I do something wrong ?\n\nSee:\n\n  http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73\n\n  and\n\n  http://git.or.cz/gitwiki/GitFaq#head-46de97a5ac549d3adf406c22674b3325ae25d09c\n\nWhat you did is OK, but there is a better way to do it.\n\n-Peff\n"},{"id":"81895","messageId":"m3vdzpfr16.fsf@localhost.localdomain","threadId":"14248","inReplyTo":"912ec82a0807010951j9e970f2k9624682b33c8af7d@mail.gmail.com","subject":"Re: git push requires a subsequent git reset --hard ?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-07-01T17:29:38Z","receivedAt":"2008-07-01T17:29:38Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Neshama Parhoti\" <pneshama@gmail.com> writes:\n\n> I took with me a copy of a local repository to a week away from my station\n> (just rsync'ed it to my laptop).\n> \n> On my return, I just \"git push myuser@my-station:/my/git/repo\" from my laptop.\n> It seemed to work with no probs.\n>\n> On my station the git repo got the new commits, as I can see in\n> git-log, but the actual files were left untouched.\n> \n> So I need to do something like \"git reset --hard HEAD\" to get\n> the changes into the local files.\n> \n> Is that considered normal ?\n\nThis is considered normal.  Push would never touch index nor working\narea (although if you are the only user, and you know what you are\ndoing, you can add \"git reset --hard HEAD\" to post-receive hook).  It\nis the only way: \"push\" cannot be opposite of \"pull\" and do a merge\nbecause there is nobody to resolve conflict on remote side.\n\nSo you should either do mirroring (1:1 refspec) push into bare\nrepository (without working directory), or push into remotes section,\nremotes/satellite or remotes/mothership, like shown in GitFaq, below.\n\nSee also:\n* \"Why won't I see changes in the remote repo after \"git push\"?\"\n  http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73\n* \"How would I use \"git push\" to sync out of a firewalled host?\"\n  http://git.or.cz/gitwiki/GitFaq#head-46de97a5ac549d3adf406c22674b3325ae25d09c\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"81974","messageId":"20080702133606.GP5737@dpotapov.dyndns.org","threadId":"14248","inReplyTo":"m3vdzpfr16.fsf@localhost.localdomain","subject":"Re: git push requires a subsequent git reset --hard ?","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-07-02T13:36:06Z","receivedAt":"2008-07-02T13:36:06Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Tue, Jul 01, 2008 at 10:29:38AM -0700, Jakub Narebski wrote:\n> \n> This is considered normal.  Push would never touch index nor working\n> area (although if you are the only user, and you know what you are\n> doing, you can add \"git reset --hard HEAD\" to post-receive hook).\n\nDoing \"reset --hard\" makes all your uncommit changes to be lost.\nOTOH, if you push on the local branch assotiated with HEAD then\nrecovering all uncommit changes later will not be easy either. So,\nI wonder, if git push should require --force if you want to push\nto the HEAD branch of a non-bare repo. It will be at least some\nwarning (especially for novices) to not to do that, and those who\nreally want to understand what they are doing can use --force.\n\nDmitry\n"},{"id":"81975","messageId":"37fcd2780807020645h463cf232oba7886cda6d7a768@mail.gmail.com","threadId":"14248","inReplyTo":"m3vdzpfr16.fsf@localhost.localdomain","subject":"Re: git push requires a subsequent git reset --hard ?","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-07-02T13:45:11Z","receivedAt":"2008-07-02T13:45:11Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Tue, Jul 01, 2008 at 10:29:38AM -0700, Jakub Narebski wrote:\n>_\n> This is considered normal.  Push would never touch index nor working\n> area (although if you are the only user, and you know what you are\n> doing, you can add \"git reset --hard HEAD\" to post-receive hook).\n\nDoing \"reset --hard\" makes all your uncommitted changes to be lost.\nOTOH, if you push on the local branch associated with HEAD then\nrecovering all uncommitted changes later will not be easy either. So,\nI wonder, if git push should require --force to push to HEAD of a\nnon-bare repository. It will be at least some warning (especially for\nnovices) to not to do that, and those who understand what they are\ndoing can use --force.\n\nDmitry\n"},{"id":"82224","messageId":"912ec82a0807040625h3d4518bo270089cb5995aec6@mail.gmail.com","threadId":"14248","inReplyTo":"20080702133606.GP5737@dpotapov.dyndns.org","subject":"Re: git push requires a subsequent git reset --hard ?","fromName":"Neshama Parhoti","fromEmail":"pneshama@gmail.com","sentAt":"2008-07-04T13:25:57Z","receivedAt":"2008-07-04T13:25:57Z","isPatch":false,"sender":{"key":"pneshama@gmail.com","avatar":null},"body":"Thank you all for the replies !\n\nI think git has one of the most supportive and friendly community !\n"}]}