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

Re: [PATCH] git-commit --amend: respect grafted parents.

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Sep 26, 2007, 12:52 UTC
Message-ID
<46FA5604.101@viscovery.net>
In-Reply-To
<Pine.LNX.4.64.0709261322150.28395@racer.site>
Johannes Schindelin schrieb:
Show 28 quoted lines
> Hi,
> 
> On Wed, 26 Sep 2007, Johannes Sixt wrote:
> 
>> This allows a poor-mans-filter-branch of the top-most commit.
>>
>> Specifically, I had this history:
>>
>>    --o--o--A'    <-- amended version of A
>>          \
>>           A
>>            \
>>     --o--B--M
>>
>> I now wanted to "amend" M to pull in A' instead of A as its second 
>> parent. For various reasons I didn't want to redo the merge M again, in 
>> particular, it already contained the changes that were amended into A'. 
>> So I figured I would just install a graft that lists B and A' as parents 
>> of M and then do a simple git commit --amend. Alas, git commit looks at 
>> the real parents instead of the grafted ones, so the amended M' would 
>> still have A as its second parent. Here is the fix that picks the 
>> grafted parents instead.
> 
> I do not think that this is a "fix".
> 
> I'd really suggest that you fix it up (before the amend!) by installing 
> the graft, and running git-filter-branch -1 <branch>.  (Note: I did not 
> test this, but it _should_ work.  If it does not, please let me know.)

The problem with filter-branch is that it leaves a committer date in M that is before A', and for this reason is not the right tool for this task. So I do think that this fix is necessary.

-- Hannes
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 8 in “git-commit --amend: respect grafted parents.”
  1. git-commit --amend: respect grafted parents.Johannes Sixt, Sep 26, 2007
  2. Johannes SchindelinSep 26, 2007
  3. Johannes SixtSep 26, 2007
  4. Johannes SchindelinSep 26, 2007
  5. Johannes SixtSep 26, 2007
  6. Junio C HamanoSep 26, 2007
  7. Johannes SchindelinSep 26, 2007
  8. David KastrupSep 27, 2007

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.