Home git rebase
Post
Cancel

git rebase

git rebase [<upstream> [<branch>]

If is specified, git rebase will perform an automatic git switch before doing anything else. Otherwise it remains on the current branch.

If is not specified, the upstream configured in branch..remote and branch..merge options will be used (see git-config(1) for details) and the --fork-point option is assumed.

All changes made by commits in the current branch but that are not in are saved to a temporary area. This is the same set of commits that would be shown by git log ..HEAD; or by git log 'fork_point'..HEAD, if --fork-point is active (see the description on --fork-point below); or by git log HEAD, if the --root option is specified.

The current branch is reset to , or if the --onto option was supplied. This has the exact same effect as git reset --hard (or ). ORIG_HEAD is set to point at the tip of the branch before the reset.

The commits that were previously saved into the temporary area are then reapplied to the current branch, one by one, in order. Note that any commits in HEAD which introduce the same textual changes as a commit in HEAD.. are omitted (i.e., a patch already accepted upstream with a different commit message or timestamp will be skipped).

This post is licensed under CC BY 4.0 by the author.