Re: My GIT Day

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: 2005-08-20 21:02:03
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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sat Aug 20 21:03:04 2005

This archive was generated by hypermail 2.1.8 : 2005-08-20 21:03:07 EST