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

Re: [PATCH] git.el: Don't reset HEAD in git-amend-file.

From
NSNikolaj Schumacher <n_schumacher@web.de>
Date
Jun 26, 2008, 20:17 UTC
Message-ID
<m2y74symr7.fsf@nschum.de>
In-Reply-To
<87tzfg7gd5.fsf@wine.dyndns.org>
Alexandre Julliard <julliard@winehq.org> wrote:
Show 12 quoted lines
> Nikolaj Schumacher <n_schumacher@web.de> writes:
>
>> The current implementation of git-amend-file is a little dangerous.
>> While git --amend is atomic, git-amend-file is not.
>>
>> If the user calls it, but doesn't go through with the commit (due to
>> error or choice), git --reset HEAD^ has been called anyway.
>
> That's a feature, even if it's a little dangerous. You have to reset
> HEAD to be able to properly do diffs, refreshes, etc.  Maybe there should
> be an easier way to redo the commit if you change your mind, but the
> command would be much less useful without the reset.

You're right, it would be less powerful. But I still think it maps better to what "git commit --amend" does, i.e. do a few changes and amend them. No need for diffing against the old head, or even showing it in the summary. For doing something more complicated I would reset head, too. So, yes, the command should exist as well. But I'm not so sure about the name...

As an aside, the current method doesn't work on the initial commit.

regards, Nikolaj Schumacher

Previous: Alexandre Julliard
Message 3 of 3 in “git.el: Don't reset HEAD in git-amend-file.”
  1. git.el: Don't reset HEAD in git-amend-file.Nikolaj Schumacher, Jun 21, 2008
  2. Alexandre JulliardJun 26, 2008
  3. Nikolaj SchumacherJun 26, 2008

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.