From: Ping Yin Date: Sat, 19 Jan 2008 08:08:55 GMT Subject: Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'? Message-ID: <46dff0320801190008p4489b7a2g6153ba7d30f942c3@mail.gmail.com> In-Reply-To: <7vbq7i9r48.fsf@gitster.siamese.dyndns.org> On Jan 19, 2008 4:06 PM, Junio C Hamano wrote: > > "Ping Yin" writes: > > > On Jan 19, 2008 3:06 PM, Junio C Hamano wrote: > >> "Ping Yin" writes: > >> > >> > I often encounter the case that the origin reposotory is rebased and i > >> > make sure i want to use the origin head as my master > >> > Now I have to do > >> > $ git fetch origin && git reset --hard origin/master > >> > >> The fact you are resetting means you do not have anything > >> interesting in your own branch yourself (--hard will lose your > >> changes and you are willing to lose it), which makes the use > >> case much less interesting, but I can understand a workflow that > >> is based around rebases, as in: > >> > >> $ git fetch origin && git rebase origin/master > >> > > I know 'git pull --rebase' and use it frequently. However, in the case > > i mentioned above, i never do any change in this local branch, i just > > use this branch for deployment which should always keep the same with > > the origin head (just like the remote tracking branch). So i need a > > 'fetch & reset --hard' equivalent, not the 'fetch & rebase' > > equivalent. > > Unless I am misreading you, you did not read what I wrote. > > If you do not have any change on that branch, "git rebase > origin/master" will be equivalent to "git reset --hard > origin/master". > But my case is that the origin head has been rewound. -- Ping Yin