{"thread":{"id":"11672","subject":"Any command to simplify 'git fetch origin && git reset --hard origin/master'?","startedAt":"2008-01-19T05:22:31Z","lastAt":"2008-01-20T08:51:19Z","messageCount":10,"participants":["Ping Yin","David Symonds","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"65937","messageId":"46dff0320801182122t1581b366yad123407aaad6326@mail.gmail.com","threadId":"11672","inReplyTo":null,"subject":"Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-01-19T05:22:31Z","receivedAt":"2008-01-19T05:22:31Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"I often encounter the case that the origin reposotory is rebased and i\nmake sure i want to use the origin head as my master\nNow I have to do\n$ git fetch origin && git reset --hard origin/master\n\nShould we introduce 'git pull --force-update' or something else to do\nthe command combination?\n\n-- \nPing Yin\n"},{"id":"65938","messageId":"ee77f5c20801182204r53ae03c2mac6d8fde9c4b260a@mail.gmail.com","threadId":"11672","inReplyTo":"46dff0320801182122t1581b366yad123407aaad6326@mail.gmail.com","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"David Symonds","fromEmail":"dsymonds@gmail.com","sentAt":"2008-01-19T06:04:43Z","receivedAt":"2008-01-19T06:04:43Z","isPatch":false,"sender":{"key":"dsymonds@gmail.com","avatar":"https://gravatar.com/avatar/b22f5051cbfc11836e36cf7a690e6cde4e225d835e13295ff98d15c7a9ee3c0f?d=mp&s=160"},"body":"On Jan 19, 2008 4:22 PM, Ping Yin <pkufranky@gmail.com> wrote:\n> I often encounter the case that the origin reposotory is rebased and i\n> make sure i want to use the origin head as my master\n> Now I have to do\n> $ git fetch origin && git reset --hard origin/master\n\nUse \"git pull origin\", which will do the fetch, and then merge it. If\nyou haven't made local changes, the merge will be a fast-forward and\nso will get you an equivalent result.\n\n\nDave.\n"},{"id":"65940","messageId":"7vr6ge9tvh.fsf@gitster.siamese.dyndns.org","threadId":"11672","inReplyTo":"46dff0320801182122t1581b366yad123407aaad6326@mail.gmail.com","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-19T07:06:42Z","receivedAt":"2008-01-19T07:06:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Ping Yin\" <pkufranky@gmail.com> writes:\n\n> I often encounter the case that the origin reposotory is rebased and i\n> make sure i want to use the origin head as my master\n> Now I have to do\n> $ git fetch origin && git reset --hard origin/master\n\nThe fact you are resetting means you do not have anything\ninteresting in your own branch yourself (--hard will lose your\nchanges and you are willing to lose it), which makes the use\ncase much less interesting, but I can understand a workflow that\nis based around rebases, as in:\n\n\t$ git fetch origin && git rebase origin/master\n\nwhich would be an equivalent to the resetting --hard when you do\nnot have anything interesting in your branch but if you do have\ninteresting commits they will be transplanted on top of the\nrebased upstream head.\n\nUpcoming 1.5.4 will have \"git pull --rebase origin\", which is a\nshort-hand for the above command.  That is a parallel for rebase\nbased workflow, just like \"git pull origin\" is a short-hand for\n\n\t$ git fetch origin && git merge origin/master\n\nto help merge based workflow.\n"},{"id":"65943","messageId":"46dff0320801190003x622a4f81j1c156f346f5bac03@mail.gmail.com","threadId":"11672","inReplyTo":"7vr6ge9tvh.fsf@gitster.siamese.dyndns.org","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-01-19T08:03:39Z","receivedAt":"2008-01-19T08:03:39Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Jan 19, 2008 3:06 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n> > I often encounter the case that the origin reposotory is rebased and i\n> > make sure i want to use the origin head as my master\n> > Now I have to do\n> > $ git fetch origin && git reset --hard origin/master\n>\n> The fact you are resetting means you do not have anything\n> interesting in your own branch yourself (--hard will lose your\n> changes and you are willing to lose it), which makes the use\n> case much less interesting, but I can understand a workflow that\n> is based around rebases, as in:\n>\n>         $ git fetch origin && git rebase origin/master\n>\nI know 'git pull --rebase' and use it frequently. However, in the case\ni mentioned above, i never do any change in this local branch, i just\nuse this branch for deployment which should always keep the same with\nthe origin head (just like the remote tracking branch). So i need a\n'fetch & reset --hard' equivalent, not the 'fetch & rebase'\nequivalent.\n\n\n\n\n-- \nPing Yin\n"},{"id":"65944","messageId":"7vbq7i9r48.fsf@gitster.siamese.dyndns.org","threadId":"11672","inReplyTo":"46dff0320801190003x622a4f81j1c156f346f5bac03@mail.gmail.com","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-19T08:06:15Z","receivedAt":"2008-01-19T08:06:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Ping Yin\" <pkufranky@gmail.com> writes:\n\n> On Jan 19, 2008 3:06 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>>\n>> > I often encounter the case that the origin reposotory is rebased and i\n>> > make sure i want to use the origin head as my master\n>> > Now I have to do\n>> > $ git fetch origin && git reset --hard origin/master\n>>\n>> The fact you are resetting means you do not have anything\n>> interesting in your own branch yourself (--hard will lose your\n>> changes and you are willing to lose it), which makes the use\n>> case much less interesting, but I can understand a workflow that\n>> is based around rebases, as in:\n>>\n>>         $ git fetch origin && git rebase origin/master\n>>\n> I know 'git pull --rebase' and use it frequently. However, in the case\n> i mentioned above, i never do any change in this local branch, i just\n> use this branch for deployment which should always keep the same with\n> the origin head (just like the remote tracking branch). So i need a\n> 'fetch & reset --hard' equivalent, not the 'fetch & rebase'\n> equivalent.\n\nUnless I am misreading you, you did not read what I wrote.\n\nIf you do not have any change on that branch, \"git rebase\norigin/master\" will be equivalent to \"git reset --hard\norigin/master\".\n"},{"id":"65945","messageId":"46dff0320801190008p4489b7a2g6153ba7d30f942c3@mail.gmail.com","threadId":"11672","inReplyTo":"7vbq7i9r48.fsf@gitster.siamese.dyndns.org","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-01-19T08:08:55Z","receivedAt":"2008-01-19T08:08:55Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Jan 19, 2008 4:06 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Ping Yin\" <pkufranky@gmail.com> writes:\n>\n> > On Jan 19, 2008 3:06 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> >> \"Ping Yin\" <pkufranky@gmail.com> writes:\n> >>\n> >> > I often encounter the case that the origin reposotory is rebased and i\n> >> > make sure i want to use the origin head as my master\n> >> > Now I have to do\n> >> > $ git fetch origin && git reset --hard origin/master\n> >>\n> >> The fact you are resetting means you do not have anything\n> >> interesting in your own branch yourself (--hard will lose your\n> >> changes and you are willing to lose it), which makes the use\n> >> case much less interesting, but I can understand a workflow that\n> >> is based around rebases, as in:\n> >>\n> >>         $ git fetch origin && git rebase origin/master\n> >>\n> > I know 'git pull --rebase' and use it frequently. However, in the case\n> > i mentioned above, i never do any change in this local branch, i just\n> > use this branch for deployment which should always keep the same with\n> > the origin head (just like the remote tracking branch). So i need a\n> > 'fetch & reset --hard' equivalent, not the 'fetch & rebase'\n> > equivalent.\n>\n> Unless I am misreading you, you did not read what I wrote.\n>\n> If you do not have any change on that branch, \"git rebase\n> origin/master\" will be equivalent to \"git reset --hard\n> origin/master\".\n>\nBut my case is that the origin head has been rewound.\n\n\n\n-- \nPing Yin\n"},{"id":"65957","messageId":"alpine.LSU.1.00.0801191114310.5731@racer.site","threadId":"11672","inReplyTo":"46dff0320801182122t1581b366yad123407aaad6326@mail.gmail.com","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-01-19T11:15:27Z","receivedAt":"2008-01-19T11:15:27Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 19 Jan 2008, Ping Yin wrote:\n\n> I often encounter the case that the origin reposotory is rebased and i\n> make sure i want to use the origin head as my master\n> Now I have to do\n> $ git fetch origin && git reset --hard origin/master\n\nJust make an alias if you're too lazy to type.\n\nPersonally, I do not see much sense in it, and it is too dangerous to \nbless it with an option to fetch or pull.\n\nCiao,\nDscho\n"},{"id":"65964","messageId":"46dff0320801190603w4f0b2595v495ed10f2a87b0cc@mail.gmail.com","threadId":"11672","inReplyTo":"alpine.LSU.1.00.0801191114310.5731@racer.site","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-01-19T14:03:26Z","receivedAt":"2008-01-19T14:03:26Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Jan 19, 2008 7:15 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Sat, 19 Jan 2008, Ping Yin wrote:\n>\n> > I often encounter the case that the origin reposotory is rebased and i\n> > make sure i want to use the origin head as my master\n> > Now I have to do\n> > $ git fetch origin && git reset --hard origin/master\n>\n> Just make an alias if you're too lazy to type.\n>\n> Personally, I do not see much sense in it, and it is too dangerous to\n> bless it with an option to fetch or pull.\n>\nCan any alias do this? Since a parameter 'origin' or something should\nbe passed in.\nOf course i can write a very simple wrapper. I just try to figure out\nthe better way.\n> Ciao,\n> Dscho\n>\n>\n\n\n\n-- \nPing Yin\n"},{"id":"65992","messageId":"alpine.LSU.1.00.0801192247280.5731@racer.site","threadId":"11672","inReplyTo":"46dff0320801190603w4f0b2595v495ed10f2a87b0cc@mail.gmail.com","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-01-19T22:50:01Z","receivedAt":"2008-01-19T22:50:01Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 19 Jan 2008, Ping Yin wrote:\n\n> On Jan 19, 2008 7:15 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>\n> > On Sat, 19 Jan 2008, Ping Yin wrote:\n> >\n> > > I often encounter the case that the origin reposotory is rebased and \n> > > i make sure i want to use the origin head as my master Now I have to \n> > > do\n> > >\t$ git fetch origin && git reset --hard origin/master\n> >\n> > Just make an alias if you're too lazy to type.\n> >\n> > Personally, I do not see much sense in it, and it is too dangerous to \n> > bless it with an option to fetch or pull.\n>\n> Can any alias do this? Since a parameter 'origin' or something should be \n> passed in.\n\nYes.  Something like\n\n\t$ git config alias.imtoolazytotype \\\n\t\t'!sh -c \"git fetch $0 && git reset --hard $0/master\"'\n\nSee http://git.or.cz/gitwiki/Aliases for more, especially the part about \nadvanced aliases with arguments.\n\nHth,\nDscho\n"},{"id":"66023","messageId":"46dff0320801200051p4dd21930u5712a72baaf9af78@mail.gmail.com","threadId":"11672","inReplyTo":"alpine.LSU.1.00.0801192247280.5731@racer.site","subject":"Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-01-20T08:51:19Z","receivedAt":"2008-01-20T08:51:19Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Jan 20, 2008 6:50 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Sat, 19 Jan 2008, Ping Yin wrote:\n>\n> > On Jan 19, 2008 7:15 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> >\n> > > On Sat, 19 Jan 2008, Ping Yin wrote:\n> > >\n> > > > I often encounter the case that the origin reposotory is rebased and\n> > > > i make sure i want to use the origin head as my master Now I have to\n> > > > do\n> > > >   $ git fetch origin && git reset --hard origin/master\n> > >\n> > > Just make an alias if you're too lazy to type.\n> > >\n> > > Personally, I do not see much sense in it, and it is too dangerous to\n> > > bless it with an option to fetch or pull.\n> >\n> > Can any alias do this? Since a parameter 'origin' or something should be\n> > passed in.\n>\n> Yes.  Something like\n>\n>         $ git config alias.imtoolazytotype \\\n>                 '!sh -c \"git fetch $0 && git reset --hard $0/master\"'\n>\n> See http://git.or.cz/gitwiki/Aliases for more, especially the part about\n> advanced aliases with arguments.\n>\nwonderful!\n> Hth,\n> Dscho\n>\n>\n\n\n\n-- \nPing Yin\n"}]}