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

Re: how to rebase backwards

From
David Kågedal <davidk@lysator.liu.se>
Date
Nov 5, 2009, 19:12 UTC
Message-ID
<877hu4zsyq.fsf@lysator.liu.se>
In-Reply-To
<20091103093716.GD7117@debian.b2j>
bill lam <cbill.lam@gmail.com> writes:
> Thank you for detail explanation.  From what you described, I begin
> with master commit D, 
>  $ git checkout -b deploy
>  $ git commit --allow-empty -m deploy

But why on earth would you want to use --allow-empty? There is no reason for that. Just let deploy be where it is when you created it (until you actually add something to it).

Show 15 quoted lines
>                       E
>                      /^ deploy
>      ---A---B---C---D
>                     ^ master
>  
>  $ git rebase -i A
>
>                       v deploy
>           B'--C'--D'--E'
>          /
>      ---A---B---C---D
>                     ^ master
>
> since E is an empty commit, I suppose content of D' E' and D are
> identical at this point.  Is that correct?
Assuming you didn't intentionally change it during rebase, yes.
> If several months later, I forget which is the common ancestor for
> master and deploy, how do I generate the above graph or identify
> commit A as the common ancestor for these two branches?

That is exactly what git does all the time. You can use many command. For instance git log --graph master...deply whill show you both branches, starting from their common ancestor. "git merge-base deploy master" will tell you that the common ancestor is. Etc.

-- 
David Kågedal
Previous: bill lamNext: bill lam
Message 4 of 5 in “how to rebase backwards”
  1. bill lamNov 3, 2009
  2. Junio C HamanoNov 3, 2009
  3. bill lamNov 3, 2009
  4. David KågedalNov 5, 2009
  5. bill lamNov 6, 2009

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.