Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15
  • (off-list ancestor, not in this archive)
  • My GIT Day · Junio C Hamano <hidden> · 2016-06-15
  • Re: My GIT Day · Johannes Schindelin <hidden> · 2016-06-15

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help