X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=Documentation%2Fgit-rebase.txt;h=520aaa94fb7b2be7c11e7eed013acf36055a41ab;hb=926b1ec63ee045503f609e88ca445b94c06bd5d7;hp=3d5a066c31675e502eb027dde824d1966c9c0f09;hpb=77f143bf3e218857ec8e5244d7e862e8e0c1a041;p=git.git diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 3d5a066c3..520aaa94f 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -9,18 +9,23 @@ SYNOPSIS -------- [verse] 'git rebase' [-i | --interactive] [options] [--onto ] - [] + [] [] 'git rebase' [-i | --interactive] [options] --onto --root [] - 'git rebase' --continue | --skip | --abort DESCRIPTION ----------- -If is specified, 'git-rebase' will perform an automatic +If is specified, 'git rebase' will perform an automatic `git checkout ` 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 +linkgit:git-config[1] for details. 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 are saved to a temporary area. This is the same set of commits that would be shown by `git log ..HEAD` (or @@ -40,7 +45,7 @@ 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 restore the +that caused the merge failure with `git rebase --skip`. To check out the original and remove the .git/rebase-apply working files, use the command `git rebase --abort` instead. @@ -66,8 +71,9 @@ would be: D---E---F---G master ------------ -The latter form is just a short-hand of `git checkout topic` -followed by `git rebase master`. +*NOTE:* The latter form is just a short-hand of `git checkout topic` +followed by `git rebase master`. When rebase exits `topic` will +remain the checked-out branch. If the upstream branch already contains a change you have made (e.g., because you mailed a patch which was applied upstream), then that commit @@ -170,8 +176,8 @@ This is useful if F and G were flawed in some way, or should not be part of topicA. Note that the argument to --onto and the parameter can be any valid commit-ish. -In case of conflict, 'git-rebase' will stop at the first problematic commit -and leave conflict markers in the tree. You can use 'git-diff' to locate +In case of conflict, 'git rebase' will stop at the first problematic commit +and leave conflict markers in the tree. You can use 'git diff' to locate the markers (<<<<<<) and make edits to resolve the conflict. For each file you edit, you need to tell git that the conflict has been resolved, typically this would be done with @@ -187,7 +193,7 @@ desired resolution, you can continue the rebasing process with git rebase --continue -Alternatively, you can undo the 'git-rebase' with +Alternatively, you can undo the 'git rebase' with git rebase --abort @@ -199,6 +205,9 @@ rebase.stat:: Whether to show a diffstat of what changed upstream since the last rebase. False by default. +rebase.autosquash:: + If set to true enable '--autosquash' option by default. + OPTIONS ------- :: @@ -206,10 +215,15 @@ OPTIONS --onto option is not specified, the starting point is . May be any valid commit, and not just an existing branch name. ++ +As a special case, you may use "A\...B" as a shortcut for the +merge base of A and B if there is exactly one merge base. You can +leave out at most one of A and B, in which case it defaults to HEAD. :: Upstream branch to compare against. May be any valid commit, - not just an existing branch name. + not just an existing branch name. Defaults to the configured + upstream for the current branch. :: Working branch; defaults to HEAD. @@ -218,7 +232,11 @@ OPTIONS Restart the rebasing process after having resolved a merge conflict. --abort:: - Restore the original branch and abort the rebase operation. + Abort the rebase operation and reset HEAD to the original + branch. If was provided when the rebase operation was + started, then HEAD will be reset to . Otherwise HEAD + will be reset to where it was when the rebase operation was + started. --skip:: Restart the rebasing process by skipping the current patch. @@ -228,14 +246,34 @@ OPTIONS 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. ++ +Note that a rebase merge works by replaying each commit from the working +branch on top of the branch. Because of this, when a merge +conflict happens, the side reported as 'ours' is the so-far rebased +series, starting with , and 'theirs' is the working branch. In +other words, the sides are swapped. -s :: --strategy=:: - Use the given merge strategy; can be supplied more than - once to specify them in the order they should be tried. - If there is no `-s` option, a built-in list of strategies - is used instead ('git-merge-recursive' when merging a single - head, 'git-merge-octopus' otherwise). This implies --merge. + Use the given merge strategy. + If there is no `-s` option 'git merge-recursive' is used + instead. This implies --merge. ++ +Because 'git rebase' replays each commit from the working branch +on top of the branch using the given strategy, using +the 'ours' strategy simply discards all patches from the , +which makes little sense. + +-X :: +--strategy-option=:: + Pass the 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 in above for the `-m` option. + +-q:: +--quiet:: + Be quiet. Implies --no-stat. -v:: --verbose:: @@ -252,6 +290,10 @@ OPTIONS --no-verify:: This option bypasses the pre-rebase hook. See also linkgit:githooks[5]. +--verify:: + Allows the pre-rebase hook to run, which is the default. This option can + be used to override --no-verify. See also linkgit:githooks[5]. + -C:: Ensure at least lines of surrounding context match before and after each change. When fewer lines of surrounding @@ -261,19 +303,28 @@ OPTIONS -f:: --force-rebase:: Force the rebase even if the current branch is a descendant - of the commit you are rebasing onto. Normally the command will + of the commit you are rebasing onto. Normally non-interactive rebase will exit with the message "Current branch is up to date" in such a situation. - + Incompatible with the --interactive option. ++ +You may find this (or --no-ff with an interactive rebase) helpful after +reverting a topic branch merge, as this option recreates the topic branch with +fresh commits so it can be remerged successfully without needing to "revert +the reversion" (see the +link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details). + +--ignore-whitespace:: --whitespace=