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

Re: [PATCH] Test that the 'rebase -i' "reword" command always cherry-picks a commit.

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Mar 23, 2010, 14:38 UTC
Message-ID
<4BA8D263.8040602@xiplink.com>
In-Reply-To
<7vd3yw84pd.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 16 quoted lines
> Marc Branchaud <marcnarc@xiplink.com> writes:
> 
>> In particular, "reword" should cherry-pick a reworded commit even if the
>> commit's message is unchanged.
>>
>> This behaviour provides a way to deal with a situation that can arise when
>> a merge had to be reverted.  Added an addendum to revert-a-faulty-merge.txt
>> describing the situation and how to use "reword" to handle it.
>> ---
>>
>> Is this more acceptable than adding --no-ff to rebase--interactive?
>>
>> I wasn't sure how to integrate the new text into revert-a-faulty-merge.txt.
>> I went with an addendum, but I'm open to other approaches.
> 
> The addendum looked readable, but I am a bit puzzled.
Ya think _you're_ puzzled?  :)
Show 25 quoted lines
> "rebase -i --no-ff"
> already exists, and is probably a more natural way to do this than saying
> "reword" but not rewording anything, no?
> 
> I would actually say "rebase -f P" would be even easier and clearer,
> especially as...
> 
>> ...
>> +However, you could avoid these problems if you recreated the entire branch,
>> +including commit A:
>> +
>> + P---o---o---M---x---x---W---x
>> + |\         /
>> + | A---B---C   <-- old branch
>> + \
>> +  A'---B'---C' <-- entirely recreated branch
>> +
>> +Now you can merge A'-B'-C' into the mainline branch without worrying about
>> +first reverting W.
>> +
>> +But if you don't actually need to change commit A, then you need some way to
>> +recreate it as a new commit with the same changes in it.
> 
> ... this part seems to talk about working around the tendency of 'rebase -i'
> to fast-forward.
Yes.  Thanks for pointing this out, it's cleared up a lot for me.

I was confused about the purpose of "rebase -f". Jonathan Nieder even pointed me to it when I posted my original patch for "rebase -i --no-ff", but the description in the man page threw me:

	Force the rebase even if the current branch is a descendant of
	the commit you are rebasing onto. Normally the command will
	exit with the message "Current branch is up to date" in such a
	situation.

I didn't realize that this is exactly the situation that "rebase -i" normally deals with (-i basically implies -f), and that "rebase -f" would do exactly what I wanted "rebase -i --no-ff" to do.

But I think I see an approach that might make sense:
 - Teach "rebase -i" to recognize the -f parameter (instead of --no-ff).
 - Update rebase's man page to better explain -f.
 - Update revert-a-faulty-merge.txt to explain how to use "rebase [-i] -f".
I'll submit a new patch shortly.
		M.
Previous: Junio C HamanoNext: Marc Branchaud
Message 18 of 32 in “Teach --no-ff option to 'rebase -i'.”
  1. Teach --no-ff option to 'rebase -i'.Marc Branchaud, Mar 16, 2010
  2. Marc BranchaudMar 16, 2010
  3. [PATCHv2] Teach --no-ff option to 'rebase -i'.Marc Branchaud, Mar 16, 2010
  4. Jonathan NiederMar 16, 2010
  5. Johannes SixtMar 17, 2010
  6. Peter BaumannMar 17, 2010
  7. Johannes SixtMar 17, 2010
  8. Peter BaumannMar 17, 2010
  9. Johannes SixtMar 18, 2010
  10. Peter BaumannMar 18, 2010
  11. Marc BranchaudMar 17, 2010
  12. Johannes SixtMar 17, 2010
  13. Marc BranchaudMar 17, 2010
  14. Test that the 'rebase -i' "reword" command always cherry-picks a commit.Marc Branchaud, Mar 22, 2010
  15. Avery PennarunMar 22, 2010
  16. Marc BranchaudMar 22, 2010
  17. Junio C HamanoMar 22, 2010
  18. Marc BranchaudMar 23, 2010
  19. [PATCHv3] Teach -f/--force-rebase option to 'rebase -i'.Marc Branchaud, Mar 23, 2010
  20. Junio C HamanoMar 23, 2010
  21. 0/2 Teach the --no-ff option to 'rebase -i'.Marc Branchaud, Mar 24, 2010
  22. Junio C HamanoMar 24, 2010
  23. [PATCHv5] Teach rebase the --no-ff option.Marc Branchaud, Mar 24, 2010
  24. Junio C HamanoMar 24, 2010
  25. 1/2 Teach 'rebase -i' to accept and ignore the -f/--force-rebase option.Marc Branchaud, Mar 24, 2010
  26. 2/2 Teach the --no-ff option to 'rebase -i'.Marc Branchaud, Mar 24, 2010
  27. Junio C HamanoMar 24, 2010
  28. Jonathan NiederMar 23, 2010
  29. Jonathan NiederMar 22, 2010
  30. Marc BranchaudMar 17, 2010
  31. Jonathan NiederMar 17, 2010
  32. Jonathan NiederMar 17, 2010

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.