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

Re: [BUG] - git rebase -i performs rebase when it shouldn't?

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 12, 2010, 17:39 UTC
Message-ID
<201004121939.17562.j6t@kdbg.org>
In-Reply-To
<20100412105034.GC30605@mageo.cz>
On Montag, 12. April 2010, Michal Vitecek wrote:
>  Is there any chance for merge to behave the same? I really like that I
>  don't have to do a checkout prior rebasing.

If you mean "prior to merging", i.e., you want a "git merge --into master", you can do it this way:

# we are on branch 'topic' here git checkout HEAD^0 # detach git merge master git reset --soft master # keep index(!!!) and worktree git checkout master # re-attach git merge topic

The point is that the second merge will succeed even with a dirty index because for each file the result of the merge is identical to the index!

If you have conflicts during the merge, resolve them in the first merge and commit to prime the rerere database; the second merge will fail for each conflicting file; just 'git checkout HEAD -- the/conflicting/file' and retry. rerere will resolve the conflicts for you.

You can of course get away with only one merge, but then you will have to do extra work to switch the parents around and to fix the commit message.

-- Hannes
Previous: Michal VitecekNext: Eugene Sajine
Message 10 of 19 in “[BUG] - git rebase -i performs rebase when it shouldn't?”
  1. Eugene SajineApr 9, 2010
  2. Jeff KingApr 10, 2010
  3. Junio C HamanoApr 10, 2010
  4. Jeff KingApr 10, 2010
  5. Johannes SixtApr 10, 2010
  6. Jeff KingApr 11, 2010
  7. Johannes SixtApr 11, 2010
  8. Jeff KingApr 12, 2010
  9. Michal VitecekApr 12, 2010
  10. Johannes SixtApr 12, 2010
  11. Eugene SajineApr 10, 2010
  12. Jeff KingApr 11, 2010
  13. Eugene SajineApr 11, 2010
  14. Eugene SajineApr 12, 2010
  15. Johannes SixtApr 12, 2010
  16. Eugene SajineApr 12, 2010
  17. Johannes SixtApr 12, 2010
  18. Eugene SajineApr 13, 2010
  19. Johannes SixtApr 14, 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.