Re: My GIT Day
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:04
Hi, On Fri, 19 Aug 2005, Junio C Hamano wrote:
$ git checkout pu
$ git reset master
This checks out the head of "pu" branch, and then resets the
index file to match "master" and updates .git/refs/heads/pu.
What it does _not_ do is to update my working tree to match the
index file. Linus recommends to do "git checkout -f" at this
point, but I typically do this instead:
$ git diff -R -p | git apply
Note. This is an embarrassingly expensive way; the only thing
it buys me over "git checkout -f" is that it removes the files
that were introduced in "pu" branch that did not exist in the
"master" head. I have to come up with a not so expensive way to
do this.
How about this?
$ git reset master
$ rm -i $(git-diff-tree ORIG_HEAD HEAD | grep "^.\{97\}D" | cut -c 100-)
$ git checkout -f
Ciao,
Dscho