rebase

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2021 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package rebase git-rebase - Reapply commits on top of another base tip.

SYNOPSIS

Reference: https://git-scm.com/docs/git-rebase

git rebase [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]
			 [<upstream> [<branch>]]
git rebase [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]
			 --root [<branch>]
git rebase --continue | --skip | --abort | --quit | --edit-todo

DESCRIPTION

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

If <upstream> is not specified, the upstream configured in branch.<name>.remote and branch.<name>.merge options will be used (see git-config(1) for details) and the --fork-point option is assumed. If you are currently not on any branch or if the current branch does not have a configured upstream, the rebase will abort.

All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area. This is the same set of commits that would be shown by git log <upstream>..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 <upstream>, or <newbase> if the --onto option was supplied. This has the exact same effect as git reset --hard <upstream> (or <newbase>). 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..<upstream> are omitted (i.e., a patch already accepted upstream with a different commit message or timestamp will be skipped).

It is possible that a merge failure will prevent this process from being completely automatic. You will have to resolve any such merge failure and run git rebase --continue. Another option is to bypass the commit that caused the merge failure with git rebase --skip. To check out the original <branch> and remove the .git/rebase-apply working files, use the command git rebase --abort instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abort

func Abort(g *types.Cmd)

Abort Abort the rebase operation and reset HEAD to the original branch. If <branch> was provided when the rebase operation was started, then HEAD will be reset to <branch>. Otherwise HEAD will be reset to where it was when the rebase operation was started. --abort

func Autosquash

func Autosquash(g *types.Cmd)

Autosquash When the commit log message begins with 'squash! ...' (or 'fixup! ...'), and there is a commit whose title begins with the same ..., automatically modify the todo list of rebase -i so that the commit marked for squashing comes right after the commit to be modified, and change the action of the moved commit from pick to squash (or fixup). Ignores subsequent 'fixup! ' or 'squash! ' after the first, in case you referred to an earlier fixup/squash with git commit --fixup/--squash. This option is only valid when the --interactive option is used. --autosquash, --no-autosquash

func Autostash

func Autostash(g *types.Cmd)

Autostash Automatically create a temporary stash before the operation begins, and apply it after the operation ends. This means that you can run rebase on a dirty worktree. However, use with care: the final stash application after a successful rebase might result in non-trivial conflicts. --autostash, --no-autostash

func Branch

func Branch(name string) func(*types.Cmd)

Branch Working branch; defaults to HEAD.

func CommitterDateIsAuthorDate

func CommitterDateIsAuthorDate(g *types.Cmd)

CommitterDateIsAuthorDate These flags are passed to git am to easily change the dates of the rebased commits (see git-am(1)). Incompatible with the --interactive option. --ignore-date

func Continue

func Continue(g *types.Cmd)

Continue Restart the rebasing process after having resolved a merge conflict. --continue

func EditTodo

func EditTodo(g *types.Cmd)

EditTodo Edit the todo list during an interactive rebase. --edit-todo

func EnsureContext

func EnsureContext(n string) func(*types.Cmd)

EnsureContext Ensure at least <n> lines of surrounding context match before and after each change. When fewer lines of surrounding context exist they all must match. By default no context is ever ignored. -C<n>

func Exec

func Exec(cmd string) func(*types.Cmd)

Exec Append 'exec <cmd>' after each line creating a commit in the final history. <cmd> will be interpreted as one or more shell commands. -x <cmd>, --exec <cmd>

func ForceRebase

func ForceRebase(g *types.Cmd)

ForceRebase Force a rebase even if the current branch is up-to-date and the command without --force would return without doing anything. -f, --force-rebase

func ForkPoint

func ForkPoint(g *types.Cmd)

ForkPoint Use reflog to find a better common ancestor between <upstream> and <branch> when calculating which commits have been introduced by <branch>. --fork-point, --no-fork-point

func GpgSign

func GpgSign(keyid string) func(*types.Cmd)

GpgSign GPG-sign commits. The keyid argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space. -S[<keyid>], --gpg-sign[=<keyid>]

func IgnoreDate

func IgnoreDate(g *types.Cmd)

IgnoreDate These flags are passed to git am to easily change the dates of the rebased commits (see git-am(1)). Incompatible with the --interactive option. --ignore-date

func IgnoreWhitespace

func IgnoreWhitespace(g *types.Cmd)

IgnoreWhitespace These flag are passed to the git apply program (see git-apply(1)) that applies the patch. Incompatible with the --interactive option. --ignore-whitespace

func Interactive

func Interactive(g *types.Cmd)

Interactive Make a list of the commits which are about to be rebased. Let the user edit that list before rebasing. This mode can also be used to split commits (see SPLITTING COMMITS below). -i, --interactive

func KeepEmpty

func KeepEmpty(g *types.Cmd)

KeepEmpty Keep the commits that do not change anything from its parents in the result. --keep-empty

func Merge

func Merge(g *types.Cmd)

Merge Use merging strategies to rebase. When the recursive (default) merge strategy is used, this allows rebase to be aware of renames on the upstream side. -m, --merge

func NoAutosquash

func NoAutosquash(g *types.Cmd)

NoAutosquash When the commit log message begins with 'squash! ...' (or 'fixup! ...'), and there is a commit whose title begins with the same ..., automatically modify the todo list of rebase -i so that the commit marked for squashing comes right after the commit to be modified, and change the action of the moved commit from pick to squash (or fixup). Ignores subsequent 'fixup! ' or 'squash! ' after the first, in case you referred to an earlier fixup/squash with git commit --fixup/--squash. This option is only valid when the --interactive option is used. --autosquash, --no-autosquash

func NoAutostash

func NoAutostash(g *types.Cmd)

NoAutostash Automatically create a temporary stash before the operation begins, and apply it after the operation ends. This means that you can run rebase on a dirty worktree. However, use with care: the final stash application after a successful rebase might result in non-trivial conflicts. --autostash, --no-autostash

func NoFf

func NoFf(g *types.Cmd)

NoFf With --interactive, cherry-pick all rebased commits instead of fast-forwarding over the unchanged ones. This ensures that the entire history of the rebased branch is composed of new commits. Without --interactive, this is a synonym for --force-rebase. --no-ff

func NoForkPoint

func NoForkPoint(g *types.Cmd)

NoForkPoint Use reflog to find a better common ancestor between <upstream> and <branch> when calculating which commits have been introduced by <branch>. --fork-point, --no-fork-point

func NoStat

func NoStat(g *types.Cmd)

NoStat Do not show a diffstat as part of the rebase process. -n, --no-stat

func NoVerify

func NoVerify(g *types.Cmd)

NoVerify This option bypasses the pre-rebase hook. See also githooks(5). --no-verify

func Onto

func Onto(newbase string) func(*types.Cmd)

Onto Starting point at which to create the new commits. If the --onto option is not specified, the starting point is <upstream>. May be any valid commit, and not just an existing branch name. --onto <newbase>

func PreserveMerges

func PreserveMerges(g *types.Cmd)

PreserveMerges Recreate merge commits instead of flattening the history by replaying commits a merge commit introduces. Merge conflict resolutions or manual amendments to merge commits are not preserved. -p, --preserve-merges

func Quiet

func Quiet(g *types.Cmd)

Quiet Be quiet. Implies --no-stat. -q, --quiet

func Quit

func Quit(g *types.Cmd)

Quit Abort the rebase operation but HEAD is not reset back to the original branch. The index and working tree are also left unchanged as a result. --quit

func Root

func Root(g *types.Cmd)

Root Rebase all commits reachable from <branch>, instead of limiting them with an <upstream>. This allows you to rebase the root commit(s) on a branch. When used with --onto, it will skip changes already contained in <newbase> (instead of <upstream>) whereas without --onto it will operate on every change. When used together with both --onto and --preserve-merges, all root commits will be rewritten to have <newbase> as parent instead. --root

func Signoff

func Signoff(g *types.Cmd)

Signoff This flag is passed to git am to sign off all the rebased commits (see git-am(1)). Incompatible with the --interactive option. --signoff

func Skip

func Skip(g *types.Cmd)

Skip Restart the rebasing process by skipping the current patch. --skip

func Stat

func Stat(g *types.Cmd)

Stat Show a diffstat of what changed upstream since the last rebase. The diffstat is also controlled by the configuration option rebase.stat. --stat

func Strategy

func Strategy(value string) func(*types.Cmd)

Strategy Use the given merge strategy. If there is no -s option git merge-recursive is used instead. This implies --merge. -s <strategy>, --strategy=<strategy>

func StrategyOption

func StrategyOption(value string) func(*types.Cmd)

StrategyOption Pass the <strategy-option> through to the merge strategy. This implies --merge and, if no strategy has been specified, -s recursive. Note the reversal of ours and theirs as noted above for the -m option. -X <strategy-option>, --strategy-option=<strategy-option>

func Upstream

func Upstream(name string) func(*types.Cmd)

Upstream Upstream branch to compare against. May be any valid commit, not just an existing branch name. Defaults to the configured upstream for the current branch.

func Verbose

func Verbose(g *types.Cmd)

Verbose Be verbose. Implies --stat. -v, --verbose

func Verify

func Verify(g *types.Cmd)

Verify Allows the pre-rebase hook to run, which is the default. This option can be used to override --no-verify. See also githooks(5). --verify

func Whitespace

func Whitespace(option string) func(*types.Cmd)

Whitespace These flag are passed to the git apply program (see git-apply(1)) that applies the patch. Incompatible with the --interactive option. --whitespace=<option>

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL