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

Re: "git reset" and newly created files.

From
Sam Ravnborg <sam@ravnborg.org>
Date
Aug 21, 2005, 21:46 UTC
Message-ID
<20050821214605.GA4134@mars.ravnborg.org>
In-Reply-To
<7vbr3rccjc.fsf@assigned-by-dhcp.cox.net>
Show 14 quoted lines
> 
> So you would naturally be tempted to do this:
> 
>     ... Re-edit, compile, and test.  This time it is perfect.
>     $ git commit -a -C ORIG_HEAD
> 
> Well, not really.  You can lose any file newly created in
> ORIG_HEAD this way.  Instead, you need to do this:
> 
>     ... Re-edit, compile, and test.  This time it is perfect.
>     $ git add <whatever file you have changed>
>     $ git commit -a -C ORIG_HEAD
> 
> Do people find this a big problem?

I often do some maybe not that brilliant changes in my tree, and when I then ask git to reset these I expect git to reset everything.

After a git-reset HEAD^ I really expect git to have rewinded back till where I started with no files added whatsoever.

>From the matter of least suprise git should not remember files added,
one have to do that by themself again if needed.
	Sam
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 3 in “"git reset" and newly created files.”
  1. Junio C HamanoAug 21, 2005
  2. Sam RavnborgAug 21, 2005
  3. Junio C HamanoAug 22, 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.