Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:06

"Ping Yin" [off-list ref] 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

which would be an equivalent to the resetting --hard when you do
not have anything interesting in your branch but if you do have
interesting commits they will be transplanted on top of the
rebased upstream head.

Upcoming 1.5.4 will have "git pull --rebase origin", which is a
short-hand for the above command.  That is a parallel for rebase
based workflow, just like "git pull origin" is a short-hand for

	$ git fetch origin && git merge origin/master

to help merge based workflow.

Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'?

From: Ping Yin <hidden>
Date: 2016-06-15 22:44:06

On Jan 19, 2008 3:06 PM, Junio C Hamano [off-list ref] wrote:
"Ping Yin" [off-list ref] writes:
quoted
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.




-- 
Ping Yin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help