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

Re: [PATCH] make git-prune-script actually work

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 24, 2005, 17:35 UTC
Message-ID
<Pine.LNX.4.58.0504241032490.15879@ppc970.osdl.org>
In-Reply-To
<1114351135.4997.18.camel@mulgrave>
On Sun, 24 Apr 2005, James Bottomley wrote:
Show 5 quoted lines
>
> I find this script very useful to get back to where I started from after
> test merges, and also for cloning trees from a non-current base.  The
> functionality is altered so it now takes an optional commit argument
> (and a -q flag to make it be quiet).

Hmm.. You should probably rename it to "git-reset-script" or something, and any time you reset the head, you should also amke sure to reset the index, because otherwise your index file may actually be referencing objects that no longer even exist, and that's going to be very very painful.

So
> +echo $head > .git/HEAD
should probably be followed by
	read-tree -m $head
	update-cache --refresh

which will also tell the user what files he has that are now "dirty" (and he can decide whether he wants to commit his changes, or whether he wants to do a "checkout-cache -f -a" to just get rid of it all).

		Linus
Previous: James Bottomley
Message 2 of 2 in “make git-prune-script actually work”
  1. make git-prune-script actually workJames Bottomley, Apr 24, 2005
  2. Linus TorvaldsApr 24, 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.