git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: My GIT Day

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 20, 2005, 11:02 UTC
Message-ID
<Pine.LNX.4.63.0508201254040.32350@wgmdd8.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7voe7tqpae.fsf@assigned-by-dhcp.cox.net>
Hi,
On Fri, 19 Aug 2005, Junio C Hamano wrote:
Show 17 quoted lines
>     $ 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

Previous: Junio C Hamano
Message 5 of 5 in “Multi-head fetches, pulls, and a King Ghidorah”
  1. Junio C HamanoAug 19, 2005
  2. Johannes SchindelinAug 19, 2005
  3. Junio C HamanoAug 19, 2005
  4. My GIT DayJunio C Hamano, Aug 20, 2005
  5. Johannes SchindelinAug 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.