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

Re: help reproduce fast-forward in rebase

From
Stephan Beyer <s-beyer@gmx.net>
Date
May 20, 2009, 09:33 UTC
Message-ID
<20090520093321.GF6169@leksak.fem-net>
In-Reply-To
<fcaeb9bf0905200113s43eb5693l24a1f8848bafabd2@mail.gmail.com>
Hi Nguyen,
Nguyen Thai Ngoc Duy wrote:
> Hi,
> 
> I'm rewriting rebase in C
Oh. First two remarks that may or may not affect you:
 1. rebase -i -p is reworked by Dscho:
    http://repo.or.cz/w/git/dscho.git?a=shortlog;h=refs/heads/rebase-i-p
 2. sequencer, a C backend for git am and git rebase -i, actually exists
    http://repo.or.cz/w/git/sbeyer.git?a=shortlog;h=refs/heads/seq-builtin-dev
    although to even more lack of time the missing/non-perfect parts are not
    getting fewer.

Both remarks regard "rebase -i" and not the am-based rebase, which means you are not getting into some kind of conflict with these other developments (or IOW: you are not doing already done work a second or third time) when you keep your rebase rewrite close to the original in sh.

Show 12 quoted lines
> and do not quite understand this code inside git-rebase.sh
> 
> # If the $onto is a proper descendant of the tip of the branch, then
> # we just fast forwarded.
> if test "$mb" = "$branch"
> then
> 	echo >&2 "Fast-forwarded $branch_name to $onto_name."
> 	move_to_original_branch
> 	exit 0
> fi
> 
> Anyone has an example how to make "git rebase" execute that code?

Yes, "if the $onto is a proper descendant of the tip of the branch", then there are no commits that have to be rewritten. Rebasing can be done by simple fast-forwarding, i.e. setting the branch to another, yet existing commit.

Example:
   * onto                 * onto, mybranch
   |                      |
   *                      *
   |                      |
   * mybranch    =>       *
   |                      |
   *                      *
   |                      |
Regards,
  Stephan
Previous: Johannes SixtNext: Nguyen Thai Ngoc Duy
Message 3 of 4 in “help reproduce fast-forward in rebase”
  1. Nguyen Thai Ngoc DuyMay 20, 2009
  2. Johannes SixtMay 20, 2009
  3. Stephan BeyerMay 20, 2009
  4. Nguyen Thai Ngoc DuyMay 20, 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.