git-rebase.txt: use back-ticks consistently
PATCH 1/1 git-rebase.txt: use back-ticks consistently
From: Derrick Stolee <[email protected]>
While inspecting the 'git rebase' documentation, I noticed that it is inconsistent with how it uses back-ticks (or other punctuation) for identifying Git commands, command-line arguments, or values for those arguments.
Sometimes, an argument (like '--interactive') would appear without any punctuation, causing the argument to not have any special formatting. Other times, arguments or 'git rebase' itself would have single-quotes giving a bold look (in the HTML documentation at least).
By consistently using back-ticks, these types of strings appear in a monospace font with special highlighting to appear more clearly as text that exists in a command-line invocation of a Git command.
This rather-large diff is the result of scanning git-rebase.txt and adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
There are also a few minor cleanups in the process, such as one place that did not use tabs for the first paragraph in a bulletted list. Another case still referred to the dashed form, but it was the only use in the file except for the heading and NAME section.
---
git-rebase.txt: use back-ticks consistently
While I noticed this inconsistency when looking at git rebase as part of
the git rebase --update-refs work, I didn't know the best way to update
the document from start to finish.
This giant update is probably not the best way to present the change.
I can see splitting it up in a few ways, but I wanted to check to first
see if that was necessary. If it is, then here are the strategies I
considered:
1. Focus on type of update. This would mean a change for adding
back-ticks on all --<option> text, adding back-ticks on all "git
rebase" instances, adding back-ticks on things like <upstream>, and
doing other types of changes like whitespace updates or "git-rebase"
to "git rebase".
2. Focus on the section of the document. This would limit the diff by
the section size, such as OPTIONS or the discussion on the backends.
3. Focus on the edits that most-recently edited these lines. Doing some
scripting, I was able to construct this date-sorted list of previous
edits (by diffing the git blame output before and after this
change). The most-recent changes before this are:
2005-08-26: 52a22d1e726 ([PATCH] Subject: [PATCH] Add some documentation., 2005-08-26)
2006-02-21: 69a60af5d0a (git-rebase: Clarify usage statement and copy it into the actual documentation., 2006-02-21)
2006-04-26: 031321c654d (Add --continue and --abort options to git-rebase., 2006-04-26)
2006-06-21: 58634dbff82 (rebase: Allow merge strategies to be used when rebasing, 2006-06-21)
2007-02-05: ea81fcc5762 (Show an example of deleting commits with git-rebase., 2007-02-05)
2007-02-08: 67dad687ad1 (add -C[NUM] to git-am, 2007-02-08)
2007-02-17: 5ca2db53763 (Attempt to improve git-rebase lead-in description., 2007-02-17)
2007-06-25: 1b1dce4bae7 (Teach rebase an interactive mode, 2007-06-25)
2007-06-25: f09c9b8c5ff (Teach rebase -i about --preserve-merges, 2007-06-25)
2007-08-31: f0fd889d7ff (rebase -i: mention the option to split commits in the man page, 2007-08-31)
2007-10-15: ff9054627c4 (git-rebase: document suppression of duplicate commits, 2007-10-15)
2008-03-10: 702088afc68 (update 'git rebase' documentation, 2008-03-10)
2008-07-03: 467c0197fd0 (Documentation: more "git-" versus "git " changes, 2008-07-03)
2008-07-08: 9869099bee3 (Documentation: mention ORIG_HEAD in am, merge, and rebase, 2008-07-08)
2008-07-21: 51ef1daa4a0 (Rename .git/rebase to .git/rebase-apply, 2008-07-21)
2008-09-13: 90d1c08efcf (Documentation: new upstream rebase recovery section in git-rebase, 2008-09-13)
2009-01-02: be496621012 (rebase: update documentation for --root, 2009-01-02)
2009-03-01: a9c3821ca2f (git-rebase: Add --stat and --no-stat for producing diffstat on rebase, 2009-03-01)
2009-06-16: 0e987a12fc1 (am, rebase: teach quiet option, 2009-06-16)
2009-10-07: 6741aa6c399 (Teach 'rebase -i' the command "reword", 2009-10-07)
2009-11-15: 31ddd1ee0fd (rebase docs: clarify --merge and --strategy, 2009-11-15)
2009-12-07: 0205e72f088 (Add a command "fixup" to rebase --interactive, 2009-12-07)
2009-12-08: f59baa502f4 (rebase -i --autosquash: auto-squash commits, 2009-12-08)
2010-01-10: 0b444cdb19b (Documentation: spell 'git cmd' without dash throughout, 2010-01-10)
2010-03-24: b499549401c (Teach rebase the --no-ff option., 2010-03-24)
2010-07-14: dd1e5b313a0 (add configuration variable for --autosquash option of interactive rebase, 2010-07-14)
2010-11-22: 7baf9c4b707 (rebase: support --verify, 2010-11-22)
2011-02-09: 15a147e6189 (rebase: use @{upstream} if no upstream specified, 2011-02-09)
2011-07-13: 5960bc9d63c (rebase: clarify "restore the original branch", 2011-07-13)
2012-03-23: d3f2475c01d (documentation: fix alphabetic ordered list for git-rebase man page, 2012-03-23)
2012-06-12: c214538416e (rebase -i: teach "--exec <cmd>", 2012-06-12)
2012-06-26: df5df20c130 (rebase -i: support --root without --onto, 2012-06-26)
2012-07-15: edfbbf7eead (doc: A few minor copy edits., 2012-07-15)
2013-05-12: 587947750bd (rebase: implement --[no-]autostash and rebase.autostash, 2013-05-12)
2014-09-18: f51a48ec3aa (Documentation/git-rebase.txt: document when --fork-point is auto-enabled, 2014-09-18)
2015-03-11: da0005b8853 (*config.txt: stick to camelCase naming convention, 2015-03-11)
2015-06-29: c9266d58948 (git-rebase -i: add command "drop" to remove a commit, 2015-06-29)
2015-09-10: 82e0668cde0 (Documentation/git-rebase: fix --no-autostash formatting, 2015-09-10)
2016-06-28: bcf9626a71a (doc: typeset long command-line options as literal, 2016-06-28)
2016-11-12: 9512177b682 (rebase: add --quit to cleanup rebase, leave everything else untouched, 2016-11-12)
2017-06-17: e01db917d8e (stash: update documentation to use 'stash entry', 2017-06-17)
2018-06-25: 5dacd4abdd3 (git-rebase.txt: document incompatible options, 2018-06-25)
2018-06-27: 0661e49aeb8 (git-rebase.txt: document behavioral differences between modes, 2018-06-27)
2018-10-12: 71f82465b1c (rebase -i: introduce the 'break' command, 2018-10-12)
2018-12-03: 6fcbad87d47 (rebase docs: fix incorrect format of the section Behavioral Differences, 2018-12-03)
2018-12-10: d421afa0c66 (rebase: introduce --reschedule-failed-exec, 2018-12-10)
2018-12-11: 68aa495b590 (rebase: implement --merge via the interactive machinery, 2018-12-11)
2019-08-27: 414d924beb4 (rebase: teach rebase --keep-base, 2019-08-27)
2020-02-15: 10cdb9f38ad (rebase: rename the two primary rebase backends, 2020-02-15)
2020-02-15: 2ac0d6273fa (rebase: change the default backend from "am" to "merge", 2020-02-15)
2020-02-15: be50c938dfc (git-rebase.txt: add more details about behavioral differences of backends, 2020-02-15)
2020-02-15: d48e5e21da9 (rebase (interactive-backend): make --keep-empty the default, 2020-02-15)
2020-02-15: e98c4269c86 (rebase (interactive-backend): fix handling of commits that become empty, 2020-02-15)
2020-03-11: 120b1eb7314 (git-rebase.txt: highlight backend differences with commit rewording, 2020-03-11)
2020-03-28: 344420bf0fb (git-rebase.txt: fix typo, 2020-03-28)
2020-04-05: f7139e7cc2d (git-rebase.txt: add another hook to the hooks section, and explain more, 2020-04-05)
2020-04-11: 0fcb4f6b62c (rebase --merge: optionally skip upstreamed commits, 2020-04-11)
2020-04-11: b9cbd2958f2 (rebase: reinstate --no-keep-empty, 2020-04-11)
2020-04-27: a35413c3785 (rebase: display an error if --root and --fork-point are both provided, 2020-04-27)
2020-05-05: c5e786abe32 (Doc: reference the "stash list" in autostash docs, 2020-05-05)
2020-07-13: ef484add9f6 (rebase -i: add --ignore-whitespace flag, 2020-07-13)
2021-01-29: 2c0aa2ce2ef (doc/git-rebase: add documentation for fixup [-C|-c] options, 2021-01-29)
2021-02-10: fa153c1cd7a (doc/rebase -i: fix typo in the documentation of 'fixup' command, 2021-02-10)
2021-03-15: 00ea64ed7a0 (doc/git-commit: add documentation for fixup=[amend|reword] options, 2021-03-15)
2021-04-09: e5b32bffd1d (rebase: don't override --no-reschedule-failed-exec with config, 2021-04-09)
2021-08-04: f5a3c5e6377 (Update docs for change of default merge backend, 2021-08-04)
2021-12-01: ddfc44a898a (update documentation for new zdiff3 conflictStyle, 2021-12-01)
2022-04-20: 9e5ebe9668a (rebase: use correct base for --keep-base when a branch is given, 2022-04-20)
Of course, maybe it's not worth splitting it up at all. I'm open to
whatever reviewers recommend.
I look forward to feedback on how to do this better (if it is indeed a
good idea to do in the first place).
Thanks, -StoleePublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1270%2Fderrickstolee%2Frebase-docs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1270/derrickstolee/rebase-docs-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1270
Documentation/git-rebase.txt | 224 +++++++++++++++++------------------ 1 file changed, 112 insertions(+), 112 deletions(-)
Documentation/git-rebase.txt +112 -112
@@ -16,40 +16,40 @@ SYNOPSIS DESCRIPTION ----------- -If <branch> is specified, 'git rebase' will perform an automatic +If `<branch>` is specified, `git rebase` will perform an automatic `git switch <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 +If `<upstream>` is not specified, the upstream configured in +`branch.<name>.remote` and `branch.<name>.merge` options will be used (see linkgit: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 +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 +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 +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. +original `<branch>` and remove the `.git/rebase-apply` working files, use +the command `git rebase --abort` instead. Assume the following history exists and the current branch is "topic":
@@ -176,11 +176,11 @@ would result in the removal of commits F and G: ------------ 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 <upstream> +part of topicA. Note that the argument to `--onto` and the `<upstream>` 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
@@ -205,8 +205,8 @@ OPTIONS ------- --onto <newbase>:: 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 + `--onto` option is not specified, the starting point is + `<upstream>`. 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
@@ -215,19 +215,19 @@ leave out at most one of A and B, in which case it defaults to HEAD. --keep-base:: Set the starting point at which to create the new commits to the - merge base of <upstream> and <branch>. Running - 'git rebase --keep-base <upstream> <branch>' is equivalent to + merge base of `<upstream>` and `<branch>`. Running + `git rebase --keep-base <upstream> <branch>` is equivalent to running - 'git rebase --onto <upstream>...<branch> <upstream> <branch>'. + `git rebase --onto <upstream>...<branch> <upstream> <branch>`. + This option is useful in the case where one is developing a feature on top of an upstream branch. While the feature is being worked on, the upstream branch may advance and it may not be the best idea to keep rebasing on top of the upstream but to keep the base commit as-is. + -Although both this option and --fork-point find the merge base between -<upstream> and <branch>, this option uses the merge base as the _starting -point_ on which new commits will be created, whereas --fork-point uses +Although both this option and `--fork-point` find the merge base between +`<upstream>` and `<branch>`, this option uses the merge base as the _starting +point_ on which new commits will be created, whereas `--fork-point` uses the merge base to determine the _set of commits_ which will be rebased. + See also INCOMPATIBLE OPTIONS below.
@@ -238,23 +238,23 @@ See also INCOMPATIBLE OPTIONS below. upstream for the current branch. <branch>:: - Working branch; defaults to HEAD. + Working branch; defaults to `HEAD`. --continue:: Restart the rebasing process after having resolved a merge conflict. --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 + 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. --quit:: - Abort the rebase operation but HEAD is not reset back to the + 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. If a temporary stash entry was created - using --autostash, it will be saved to the stash list. + using `--autostash`, it will be saved to the stash list. --apply:: Use applying strategies to rebase (calling `git-am`
@@ -269,16 +269,16 @@ See also INCOMPATIBLE OPTIONS below. empty after rebasing (because they contain a subset of already upstream changes). With drop (the default), commits that become empty are dropped. With keep, such commits are kept. - With ask (implied by --interactive), the rebase will halt when + With ask (implied by `--interactive`), the rebase will halt when an empty commit is applied allowing you to choose whether to drop it, edit files more, or just commit the empty changes. - Other options, like --exec, will use the default of drop unless - -i/--interactive is explicitly specified. + Other options, like `--exec`, will use the default of drop unless + `-i`/`--interactive` is explicitly specified. + -Note that commits which start empty are kept (unless --no-keep-empty +Note that commits which start empty are kept (unless `--no-keep-empty` is specified), and commits which are clean cherry-picks (as determined by `git log --cherry-mark ...`) are detected and dropped as a -preliminary step (unless --reapply-cherry-picks is passed). +preliminary step (unless `--reapply-cherry-picks` is passed). + See also INCOMPATIBLE OPTIONS below.
@@ -287,7 +287,7 @@ See also INCOMPATIBLE OPTIONS below. Do not keep commits that start empty before the rebase (i.e. that do not change anything from its parent) in the result. The default is to keep commits which start empty, - since creating such commits requires passing the --allow-empty + since creating such commits requires passing the `--allow-empty` override flag to `git commit`, signifying that a user is very intentionally creating such a commit and thus wants to keep it.
@@ -299,7 +299,7 @@ flag exists as a convenient shortcut, such as for cases where external tools generate many empty commits and you want them all removed. + For commits which do not start empty but become empty after rebasing, -see the --empty flag. +see the `--empty` flag. + See also INCOMPATIBLE OPTIONS below.
@@ -348,10 +348,10 @@ See also INCOMPATIBLE OPTIONS below. Using merging strategies to rebase (default). + Note that a rebase merge works by replaying each commit from the working -branch on top of the <upstream> branch. Because of this, when a merge +branch on top of the `<upstream>` branch. Because of this, when a merge conflict happens, the side reported as 'ours' is the so-far rebased -series, starting with <upstream>, and 'theirs' is the working branch. In -other words, the sides are swapped. +series, starting with `<upstream>`, and 'theirs' is the working branch. +In other words, the sides are swapped. + See also INCOMPATIBLE OPTIONS below.
@@ -360,9 +360,9 @@ See also INCOMPATIBLE OPTIONS below. Use the given merge strategy, instead of the default `ort`. This implies `--merge`. + -Because 'git rebase' replays each commit from the working branch -on top of the <upstream> branch using the given strategy, using -the 'ours' strategy simply empties all patches from the <branch>, +Because `git rebase` replays each commit from the working branch +on top of the `<upstream>` branch using the given strategy, using +the `ours` strategy simply empties all patches from the `<branch>`, which makes little sense. + See also INCOMPATIBLE OPTIONS below.
@@ -371,8 +371,8 @@ See also INCOMPATIBLE OPTIONS below. --strategy-option=<strategy-option>:: Pass the <strategy-option> through to the merge strategy. This implies `--merge` and, if no strategy has been - specified, `-s ort`. Note the reversal of 'ours' and - 'theirs' as noted above for the `-m` option. + specified, `-s ort`. Note the reversal of `ours` and + `theirs` as noted above for the `-m` option. + See also INCOMPATIBLE OPTIONS below.
@@ -392,11 +392,11 @@ See also INCOMPATIBLE OPTIONS below. -q:: --quiet:: - Be quiet. Implies --no-stat. + Be quiet. Implies `--no-stat`. -v:: --verbose:: - Be verbose. Implies --stat. + Be verbose. Implies `--stat`. --stat:: Show a diffstat of what changed upstream since the last rebase. The
@@ -411,13 +411,13 @@ See also INCOMPATIBLE OPTIONS below. --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]. + be used to override `--no-verify`. See also linkgit:githooks[5]. -C<n>:: - Ensure at least <n> lines of surrounding context match before + 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. Implies --apply. + ever ignored. Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.
@@ -436,21 +436,21 @@ details). --fork-point:: --no-fork-point:: - Use reflog to find a better common ancestor between <upstream> - and <branch> when calculating which commits have been - introduced by <branch>. + Use reflog to find a better common ancestor between `<upstream>` + and `<branch>` when calculating which commits have been + introduced by `<branch>`. + -When --fork-point is active, 'fork_point' will be used instead of -<upstream> to calculate the set of commits to rebase, where +When `--fork-point` is active, 'fork_point' will be used instead of +`<upstream>` to calculate the set of commits to rebase, where 'fork_point' is the result of `git merge-base --fork-point <upstream> <branch>` command (see linkgit:git-merge-base[1]). If 'fork_point' -ends up being empty, the <upstream> will be used as a fallback. +ends up being empty, the `<upstream>` will be used as a fallback. + -If <upstream> is given on the command line, then the default is +If `<upstream>` is given on the command line, then the default is `--no-fork-point`, otherwise the default is `--fork-point`. See also `rebase.forkpoint` in linkgit:git-config[1]. + -If your branch was based on <upstream> but <upstream> was rewound and +If your branch was based on `<upstream>` but `<upstream>` was rewound and your branch contains commits which were dropped, this option can be used with `--keep-base` in order to drop those commits from your branch. +
@@ -458,24 +458,24 @@ See also INCOMPATIBLE OPTIONS below. --ignore-whitespace:: Ignore whitespace differences when trying to reconcile -differences. Currently, each backend implements an approximation of -this behavior: + differences. Currently, each backend implements an approximation of + this behavior: + -apply backend: When applying a patch, ignore changes in whitespace in +'apply backend:' When applying a patch, ignore changes in whitespace in context lines. Unfortunately, this means that if the "old" lines being replaced by the patch differ only in whitespace from the existing file, you will get a merge conflict instead of a successful patch application. + -merge backend: Treat lines with only whitespace changes as unchanged +'merge backend:' Treat lines with only whitespace changes as unchanged when merging. Unfortunately, this means that any patch hunks that were intended to modify whitespace and nothing else will be dropped, even if the other side had no changes that conflicted. --whitespace=<option>:: - This flag is passed to the 'git apply' program + This flag is passed to the `git apply` program (see linkgit:git-apply[1]) that applies the patch. - Implies --apply. + Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.
@@ -536,8 +536,8 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: - Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + Append `exec <cmd>` after each line creating a commit in the + final history. `<cmd>` will be interpreted as one or more shell commands. Any command that fails will interrupt the rebase, with exit code 1. +
@@ -550,7 +550,7 @@ or by giving more than one `--exec`: + git rebase -i --exec "cmd1" --exec "cmd2" --exec ... + -If `--autosquash` is used, "exec" lines will not be appended for +If `--autosquash` is used, `exec` lines will not be appended for the intermediate commits, and will only appear at the end of each squash/fixup series. +
@@ -560,11 +560,12 @@ without an explicit `--interactive`. See also INCOMPATIBLE OPTIONS below. --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. + 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. + See also INCOMPATIBLE OPTIONS below.
@@ -643,9 +644,9 @@ In addition, the following pairs of options are incompatible: BEHAVIORAL DIFFERENCES ----------------------- -git rebase has two primary backends: apply and merge. (The apply -backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +`git rebase` has two primary backends: `apply` and `merge`. (The `apply` +backend used to be known as the `am` backend, but the name led to +confusion as it looks like a verb instead of a noun. Also, the `merge` backend used to be known as the interactive backend, but it is now used for non-interactive cases as well. Both were renamed based on lower-level functionality that underpinned each.) There are some
@@ -654,19 +655,19 @@ subtle differences in how these two backends behave: Empty commits ~~~~~~~~~~~~~ -The apply backend unfortunately drops intentionally empty commits, i.e. +The `apply` backend unfortunately drops intentionally empty commits, i.e. commits that started empty, though these are rare in practice. It also drops commits that become empty and has no option for controlling this behavior. -The merge backend keeps intentionally empty commits by default (though -with -i they are marked as empty in the todo list editor, or they can -be dropped automatically with --no-keep-empty). +The `merge` backend keeps intentionally empty commits by default (though +with `-i` they are marked as empty in the todo list editor, or they can +be dropped automatically with `--no-keep-empty`). Similar to the apply backend, by default the merge backend drops -commits that become empty unless -i/--interactive is specified (in +commits that become empty unless `-i`/`--interactive` is specified (in which case it stops and asks the user what to do). The merge backend -also has an --empty={drop,keep,ask} option for changing the behavior +also has an `--empty={drop,keep,ask}` option for changing the behavior of handling commits that become empty. Directory rename detection
@@ -674,20 +675,20 @@ Directory rename detection Due to the lack of accurate tree information (arising from constructing fake ancestors with the limited information available in -patches), directory rename detection is disabled in the apply backend. +patches), directory rename detection is disabled in the `apply` backend. Disabled directory rename detection means that if one side of history renames a directory and the other adds new files to the old directory, then the new files will be left behind in the old directory without any warning at the time of rebasing that you may want to move these files into the new directory. -Directory rename detection works with the merge backend to provide you +Directory rename detection works with the `merge` backend to provide you warnings in such cases. Context ~~~~~~~ -The apply backend works by creating a sequence of patches (by calling +The `apply` backend works by creating a sequence of patches (by calling `format-patch` internally), and then applying the patches in sequence (calling `am` internally). Patches are composed of multiple hunks, each with line numbers, a context region, and the actual changes. The
@@ -698,11 +699,11 @@ order to apply the changes to the right lines. However, if multiple areas of the code have the same surrounding lines of context, the wrong one can be picked. There are real-world cases where this has caused commits to be reapplied incorrectly with no conflicts reported. -Setting diff.context to a larger value may prevent such types of +Setting `diff.context` to a larger value may prevent such types of problems, but increases the chance of spurious conflicts (since it will require more lines of matching context to apply). -The merge backend works with a full copy of each relevant file, +The `merge` backend works with a full copy of each relevant file, insulating it from these types of problems. Labelling of conflicts markers
@@ -710,30 +711,30 @@ Labelling of conflicts markers When there are content conflicts, the merge machinery tries to annotate each side's conflict markers with the commits where the -content came from. Since the apply backend drops the original +content came from. Since the `apply` backend drops the original information about the rebased commits and their parents (and instead generates new fake commits based off limited information in the generated patches), those commits cannot be identified; instead it has -to fall back to a commit summary. Also, when merge.conflictStyle is -set to diff3 or zdiff3, the apply backend will use "constructed merge +to fall back to a commit summary. Also, when `merge.conflictStyle` is +set to `diff3` or `zdiff3`, the `apply` backend will use "constructed merge base" to label the content from the merge base, and thus provide no information about the merge base commit whatsoever. -The merge backend works with the full commits on both sides of history +The `merge` backend works with the full commits on both sides of history and thus has no such limitations. Hooks ~~~~~ -The apply backend has not traditionally called the post-commit hook, -while the merge backend has. Both have called the post-checkout hook, -though the merge backend has squelched its output. Further, both +The `apply` backend has not traditionally called the post-commit hook, +while the `merge` backend has. Both have called the post-checkout hook, +though the `merge` backend has squelched its output. Further, both backends only call the post-checkout hook with the starting point commit of the rebase, not the intermediate commits nor the final commit. In each case, the calling of these hooks was by accident of implementation rather than by design (both backends were originally implemented as shell scripts and happened to invoke other commands -like 'git checkout' or 'git commit' that would call the hooks). Both +like `git checkout` or `git commit` that would call the hooks). Both backends should have the same behavior, though it is not entirely clear which, if any, is correct. We will likely make rebase stop calling either of these hooks in the future.
@@ -741,10 +742,10 @@ calling either of these hooks in the future. Interruptability ~~~~~~~~~~~~~~~~ -The apply backend has safety problems with an ill-timed interrupt; if +The `apply` backend has safety problems with an ill-timed interrupt; if the user presses Ctrl-C at the wrong time to try to abort the rebase, the rebase can enter a state where it cannot be aborted with a -subsequent `git rebase --abort`. The merge backend does not appear to +subsequent `git rebase --abort`. The `merge` backend does not appear to suffer from the same shortcoming. (See https://lore.kernel.org/git/[email protected]/ for details.)
@@ -756,8 +757,8 @@ When a conflict occurs while rebasing, rebase stops and asks the user to resolve. Since the user may need to make notable changes while resolving conflicts, after conflicts are resolved and the user has run `git rebase --continue`, the rebase should open an editor and ask the -user to update the commit message. The merge backend does this, while -the apply backend blindly applies the original commit message. +user to update the commit message. The `merge` backend does this, while +the `apply` backend blindly applies the original commit message. Miscellaneous differences ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -777,23 +778,23 @@ completeness: them to stderr. * State directories: The two backends keep their state in different - directories under .git/ + directories under `.git/` include::merge-strategies.txt[] NOTES ----- -You should understand the implications of using 'git rebase' on a +You should understand the implications of using `git rebase` on a repository that you share. See also RECOVERING FROM UPSTREAM REBASE below. -When the git-rebase command is run, it will first execute a "pre-rebase" +When the `git rebase` command is run, it will first execute a "pre-rebase" hook if one exists. You can use this hook to do sanity checks and reject the rebase if it isn't appropriate. Please see the template pre-rebase hook script for an example. -Upon completion, <branch> will be the current branch. +Upon completion, `<branch>` will be the current branch. INTERACTIVE MODE ----------------
@@ -848,7 +849,7 @@ not look at them but at the commit names ("deadbee" and "fa1afe1" in this example), so do not delete or edit the names. By replacing the command "pick" with the command "edit", you can tell -'git rebase' to stop after applying that commit, so that you can edit +`git rebase` to stop after applying that commit, so that you can edit the files and/or the commit message, amend the commit, and continue rebasing.
@@ -876,14 +877,13 @@ commit, the message from the final one is used. You can also use "fixup -C" to get the same behavior as "fixup -c" except without opening an editor. - -'git rebase' will stop when "pick" has been replaced with "edit" or +`git rebase` will stop when "pick" has been replaced with "edit" or when a command fails due to merge errors. When you are done editing and/or resolving conflicts you can continue with `git rebase --continue`. For example, if you want to reorder the last 5 commits, such that what -was HEAD~4 becomes the new HEAD. To achieve that, you would call -'git rebase' like this: +was `HEAD~4` becomes the new `HEAD`. To achieve that, you would call +`git rebase` like this: ---------------------- $ git rebase -i HEAD~5
@@ -903,7 +903,7 @@ like this: ------------------ Suppose you want to rebase the side branch starting at "A" to "Q". Make -sure that the current HEAD is "B", and call +sure that the current `HEAD` is "B", and call ----------------------------- $ git rebase -i -r --onto Q O
@@ -956,23 +956,23 @@ SPLITTING COMMITS ----------------- In interactive mode, you can mark commits with the action "edit". However, -this does not necessarily mean that 'git rebase' expects the result of this +this does not necessarily mean that `git rebase` expects the result of this edit to be exactly one commit. Indeed, you can undo the commit, or you can add other commits. This can be used to split a commit into two: - Start an interactive rebase with `git rebase -i <commit>^`, where - <commit> is the commit you want to split. In fact, any commit range + `<commit>` is the commit you want to split. In fact, any commit range will do, as long as it contains that commit. - Mark the commit you want to split with the action "edit". - When it comes to editing that commit, execute `git reset HEAD^`. The - effect is that the HEAD is rewound by one, and the index follows suit. + effect is that the `HEAD` is rewound by one, and the index follows suit. However, the working tree stays the same. - Now add the changes to the index that you want to have in the first commit. You can use `git add` (possibly interactively) or - 'git gui' (or both) to do that. + `git gui` (or both) to do that. - Commit the now-current index with whatever commit message is appropriate now.
@@ -983,7 +983,7 @@ add other commits. This can be used to split a commit into two: If you are not absolutely sure that the intermediate revisions are consistent (they compile, pass the testsuite, etc.) you should use -'git stash' to stash away the not-yet-committed changes +`git stash` to stash away the not-yet-committed changes after each commit, test, and amend the commit if fixes are necessary.
@@ -1087,12 +1087,12 @@ NOTE: While an "easy case recovery" sometimes appears to be successful example, a commit that was removed via `git rebase --interactive` will be **resurrected**! -The idea is to manually tell 'git rebase' "where the old 'subsystem' +The idea is to manually tell `git rebase` "where the old 'subsystem' ended and your 'topic' began", that is, what the old merge base between them was. You will have to find a way to name the last commit of the old 'subsystem', for example: -* With the 'subsystem' reflog: after 'git fetch', the old tip of +* With the 'subsystem' reflog: after `git fetch`, the old tip of 'subsystem' is at `subsystem@{1}`. Subsequent fetches will increase the number. (See linkgit:git-reflog[1].)
base-commit: 9bef0b1e6ec371e786c2fba3edcc06ad040a536c
Signature · 1 line
gitgitgadget
Hi Stolee
Quoted 20 lines · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
While inspecting the 'git rebase' documentation, I noticed that it is inconsistent with how it uses back-ticks (or other punctuation) for identifying Git commands, command-line arguments, or values for those arguments.
Sometimes, an argument (like '--interactive') would appear without any punctuation, causing the argument to not have any special formatting. Other times, arguments or 'git rebase' itself would have single-quotes giving a bold look (in the HTML documentation at least).
By consistently using back-ticks, these types of strings appear in a monospace font with special highlighting to appear more clearly as text that exists in a command-line invocation of a Git command.
This rather-large diff is the result of scanning git-rebase.txt and adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
Quoted 6 lines
There are also a few minor cleanups in the process, such as one place that did not use tabs for the first paragraph in a bulletted list. Another case still referred to the dashed form, but it was the only use in the file except for the heading and NAME section.
Signed-off-by Derrick Stolee <[email protected]>
Thanks for doing this, I think it's fine as a single patch as all the changes are focussed making the quoting more consistent in a single file - splitting it up would be more work for you and would not really make it any easier for reviewers. I've left a few comments but it is a vast improvement as is.
Documentation/git-rebase.txt SYNOPSIS · line 38
Quoted 6 lines
Documentation/git-rebase.txt +3
-3-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 +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
Unrelated to your change but I think we could lose the comma on this line if you do re-roll.
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 354
Quoted 8 lines
Note that a rebase merge works by replaying each commit from the working
Documentation/git-rebase.txt +3
-3-branch on top of the <upstream> branch. Because of this, when a merge +branch on top of the `<upstream>` branch. Because of this, when a merge conflict happens, the side reported as 'ours' is the so-far rebased -series, starting with <upstream>, and 'theirs' is the working branch. In -other words, the sides are swapped. +series, starting with `<upstream>`, and 'theirs' is the working branch. +In other words, the sides are swapped.
Here when talking about "ours" and "theirs" as the parents of a merge we use single quotes ...
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 365
Quoted 6 lines
Documentation/git-rebase.txt +3
-3-Because 'git rebase' replays each commit from the working branch -on top of the <upstream> branch using the given strategy, using -the 'ours' strategy simply empties all patches from the <branch>, +Because `git rebase` replays each commit from the working branch +on top of the `<upstream>` branch using the given strategy, using +the `ours` strategy simply empties all patches from the `<branch>`,
Here "ours" is an option argument so I think the backquotes make sense
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 375
Quoted 8 lines
Documentation/git-rebase.txt +2
-2@@ -371,8 +371,8 @@ See also INCOMPATIBLE OPTIONS below. --strategy-option=<strategy-option>:: Pass the <strategy-option> through to the merge strategy. This implies `--merge` and, if no strategy has been - specified, `-s ort`. Note the reversal of 'ours' and - 'theirs' as noted above for the `-m` option. + specified, `-s ort`. Note the reversal of `ours` and + `theirs` as noted above for the `-m` option.
Here "ours" and "theirs" are options so using backquotes is probably the right thing to do, but the text is referring to the section where they are not backquoted which confused me initially.
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 413
Quoted 2 lines
Documentation/git-rebase.txt +0
-0--verify:: Allows the pre-rebase hook to run, which is the default. This option can
Lower down some hook names are in double quotes which is probably a good idea but not strictly related to your patch.
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 464
Quoted 2 lines
Documentation/git-rebase.txt +1
-1-apply backend: When applying a patch, ignore changes in whitespace in +'apply backend:' When applying a patch, ignore changes in whitespace in
I'm not sure if we want to say
'apply backend:'
or
'apply' backend:
Documentation/git-rebase.txt See also REBASING MERGES and INCOMPATIBLE OPTIONS below. · line 539
Quoted 6 lines
-x <cmd>::
--exec <cmd>::Documentation/git-rebase.txt +1
-2- Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + Append `exec <cmd>` after each line creating a commit in the
Lower down when talking about other todo list commands we refer to them as "pick" (with double quotes) so I wonder if we should use "exec <cmd>" here as it is only <cmd> that comes from the command line argument
Documentation/git-rebase.txt In addition, the following pairs of options are incompatible: · line 649
Quoted 6 lines
Documentation/git-rebase.txt +3
-3-git rebase has two primary backends: apply and merge. (The apply -backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +`git rebase` has two primary backends: `apply` and `merge`. (The `apply` +backend used to be known as the `am` backend, but the name led to +confusion as it looks like a verb instead of a noun. Also, the `merge`
I think using single quotes for the backend names might make more sense as they are just names.
Documentation/git-rebase.txt completeness: · line 792
Quoted 2 lines
Documentation/git-rebase.txt +1
-1-When the git-rebase command is run, it will first execute a "pre-rebase" +When the `git rebase` command is run, it will first execute a "pre-rebase"
This is the section I was referring to earlier when talking about quoting hook names.
Thanks for working on this, it is great to have more consistent markup in the documentation
Best Wishes
Phillip
Quoted 5 lines · Phillip Wood
Hi Stolee
On 27/06/2022 22:21, Derrick Stolee via GitGitGadget wrote:
Thanks for doing this, I think it's fine as a single patch as all the changes are focussed making the quoting more consistent in a single file - splitting it up would be more work for you and would not really make it any easier for reviewers. I've left a few comments but it is a vast improvement as is.
Thanks for taking such a close look!
Quoted 8 lines
Documentation/git-rebase.txt SYNOPSIS · line 38
Quoted 6 lines
Documentation/git-rebase.txt +3
-3-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 +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 setUnrelated to your change but I think we could lose the comma on this line if you do re-roll.
Noted. Thanks.
Quoted 10 lines
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 354
Quoted 8 lines
Note that a rebase merge works by replaying each commit from the working
Documentation/git-rebase.txt +1
-1-branch on top of the <upstream> branch. Because of this, when a merge +branch on top of the `<upstream>` branch. Because of this, when a mergeconflict happens, the side reported as 'ours' is the so-far rebased
Documentation/git-rebase.txt +2
-2-series, starting with <upstream>, and 'theirs' is the working branch. In -other words, the sides are swapped. +series, starting with `<upstream>`, and 'theirs' is the working branch. +In other words, the sides are swapped.Here when talking about "ours" and "theirs" as the parents of a merge we use single quotes ...
Good point...
Quoted 8 lines
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 365
Quoted 6 lines
Documentation/git-rebase.txt +3
-3-Because 'git rebase' replays each commit from the working branch -on top of the <upstream> branch using the given strategy, using -the 'ours' strategy simply empties all patches from the <branch>, +Because `git rebase` replays each commit from the working branch +on top of the `<upstream>` branch using the given strategy, using +the `ours` strategy simply empties all patches from the `<branch>`,Here "ours" is an option argument so I think the backquotes make sense
I agree.
Quoted 10 lines
Quoted 8 lines
(quoted diff) +0
-0@@ -371,8 +371,8 @@ See also INCOMPATIBLE OPTIONS below.--strategy-option=<strategy-option>::
Pass the <strategy-option> through to the merge strategy. This implies--mergeand, if no strategy has been - specified,-s ort. Note the reversal of 'ours' and - 'theirs' as noted above for the-moption.
+ specified,-s ort. Note the reversal ofoursand +theirsas noted above for the-moption.Here "ours" and "theirs" are options so using backquotes is probably the right thing to do, but the text is referring to the section where they are not backquoted which confused me initially.
I think your confusion makes sense. Here, we are talking about "sides" of a merge and not a strategy. I'll fix this in v2.
Quoted 7 lines
Quoted 2 lines
-apply backend: When applying a patch, ignore changes in whitespace in +'apply backend:' When applying a patch, ignore changes in whitespace in
I'm not sure if we want to say
'apply backend:'
or
'apply' backend:
Quoted 7 lines
Quoted 5 lines
-x <cmd>::
--exec <cmd>::
- Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + Appendexec <cmd>after each line creating a commit in theLower down when talking about other todo list commands we refer to them as "pick" (with double quotes) so I wonder if we should use "exec
<cmd>" here as it is only <cmd> that comes from the command line argument
Junio has some ideas about making this a bulletted list more clearly, so I'll try that and see what happens.
Quoted 8 lines
Documentation/git-rebase.txt In addition, the following pairs of options are incompatible: · line 649
Quoted 6 lines
Documentation/git-rebase.txt +3
-3-git rebase has two primary backends: apply and merge. (The apply -backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +`git rebase` has two primary backends: `apply` and `merge`. (The `apply` +backend used to be known as the `am` backend, but the name led to +confusion as it looks like a verb instead of a noun. Also, the `merge`I think using single quotes for the backend names might make more sense as they are just names.
I was thinking of them similar to the merge strategies, but you're right that these are not used as CLI input (just something implied by --merge or --apply). I'll remove the ticks from around these uses.
Quoted 4 lines
Documentation/git-rebase.txt completeness: · line 792
Quoted 2 lines
Documentation/git-rebase.txt +1
-1-When the git-rebase command is run, it will first execute a "pre-rebase" +When the `git rebase` command is run, it will first execute a "pre-rebase"This is the section I was referring to earlier when talking about quoting hook names.
Excellent. Will fix.
Thanks,
-Stolee
Quoted 1 line · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
This looks 99% good, but...
Quoted 14 lines
While inspecting the 'git rebase' documentation, I noticed that it is inconsistent with how it uses back-ticks (or other punctuation) for identifying Git commands, command-line arguments, or values for those arguments.
Sometimes, an argument (like '--interactive') would appear without any punctuation, causing the argument to not have any special formatting. Other times, arguments or 'git rebase' itself would have single-quotes giving a bold look (in the HTML documentation at least).
By consistently using back-ticks, these types of strings appear in a monospace font with special highlighting to appear more clearly as text that exists in a command-line invocation of a Git command.
Quoted 8 lines
This rather-large diff is the result of scanning git-rebase.txt and adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
There are also a few minor cleanups in the process, such as one place that did not use tabs for the first paragraph in a bulletted list. Another case still referred to the dashed form, but it was the only use in the file except for the heading and NAME section.
I think the commit message should speak more matter-of-factly & briefly, i.e. just "change so and so...".
Quoted 16 lines
While I noticed this inconsistency when looking at git rebase as part of the git rebase --update-refs work, I didn't know the best way to update the document from start to finish.
This giant update is probably not the best way to present the change.
I can see splitting it up in a few ways, but I wanted to check to first see if that was necessary. If it is, then here are the strategies I considered:
1. Focus on type of update. This would mean a change for adding back-ticks on all --<option> text, adding back-ticks on all "git rebase" instances, adding back-ticks on things like <upstream>, and doing other types of changes like whitespace updates or "git-rebase" to "git rebase".
Quoted 7 lines
2. Focus on the section of the document. This would limit the diff by the section size, such as OPTIONS or the discussion on the backends.
3. Focus on the edits that most-recently edited these lines. Doing some scripting, I was able to construct this date-sorted list of previous edits (by diffing the git blame output before and after this change). The most-recent changes before this are:
I think this is fine, but I want to recommend doc-diff in your toolkit, e.g.:
$ Documentation/doc-diff HEAD~ HEAD -- -U0|cat diff --git a/e4a4b31577c7419497ac30cebe30d755b97752c5/home/avar/share/man/man1/git-rebase.1 b/e37244faa0a730bb930dac4e10d8eed4af682a5d/home/avar/share/man/man1/git-rebase.1 index 91ccda823b2..41dfbee38a4 100644 --- a/e4a4b31577c7419497ac30cebe30d755b97752c5/home/avar/share/man/man1/git-rebase.1 +++ b/e37244faa0a730bb930dac4e10d8eed4af682a5d/home/avar/share/man/man1/git-rebase.1 @@ -489,2 +489,2 @@ OPTIONS - Append "exec <cmd>" after each line creating a commit in the final - history. <cmd> will be interpreted as one or more shell commands. + Append exec <cmd> after each line creating a commit in the final + history. <cmd> will be interpreted as one or more shell commands. @@ -502 +502 @@ OPTIONS - If --autosquash is used, "exec" lines will not be appended for the + If --autosquash is used, exec lines will not be appended for the @@ -880 +880 @@ NOTES - When the git-rebase command is run, it will first execute a + When the git rebase command is run, it will first execute a
I see Phillip spotted some of this already, but the "exec" change here looks unwanted, i.e. let's use double quotes there.
For the last hunk I'd think just:
When rebase is run, it will...
Would be briefer & better in that case.
I also see that we have other spots in our wider docs where we use the dashed form, I'm fine with converting this case, but maybe better to leave it aside to make this only a ``-quotation change, or to split up this & the whitespace & other things you mentioned into another commit.
Any way you're OK with is fine with me, thanks for fixing these.
Rendering back-ticks in plaintext docs (was Re: [PATCH] git-rebase.txt: use back-ticks consistently)
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Quoted 1 line · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
This looks 99% good, but...
Quoted 7 lines
Quoted 4 lines
3. Focus on the edits that most-recently edited these lines. Doing some scripting, I was able to construct this date-sorted list of previous edits (by diffing the git blame output before and after this change). The most-recent changes before this are:
I think this is fine, but I want to recommend doc-diff in your toolkit, e.g.:
Thanks for the recommendation!
Quoted 17 lines
$ Documentation/doc-diff HEAD~ HEAD -- -U0|cat diff --git a/e4a4b31577c7419497ac30cebe30d755b97752c5/home/avar/share/man/man1/git-rebase.1 b/e37244faa0a730bb930dac4e10d8eed4af682a5d/home/avar/share/man/man1/git-rebase.1 index 91ccda823b2..41dfbee38a4 100644 --- a/e4a4b31577c7419497ac30cebe30d755b97752c5/home/avar/share/man/man1/git-rebase.1 +++ b/e37244faa0a730bb930dac4e10d8eed4af682a5d/home/avar/share/man/man1/git-rebase.1 @@ -489,2 +489,2 @@ OPTIONS - Append "exec <cmd>" after each line creating a commit in the final - history. <cmd> will be interpreted as one or more shell commands. + Append exec <cmd> after each line creating a commit in the final + history. <cmd> will be interpreted as one or more shell commands. @@ -502 +502 @@ OPTIONS - If --autosquash is used, "exec" lines will not be appended for the + If --autosquash is used, exec lines will not be appended for the @@ -880 +880 @@ NOTES - When the git-rebase command is run, it will first execute a + When the git rebase command is run, it will first execute a
Quoted 2 lines
I see Phillip spotted some of this already, but the "exec" change here looks unwanted, i.e. let's use double quotes there.
This is definitely an issue where I was looking at the HTML formatted output, which respects back-ticks. Thanks for pointing out that the text docs just ignore back-ticks. This seems problematic, in my opinion.
Is it possible to update our doc formatting to convert back-ticks into something like single quotes? That would help these plain-text documents point out these places where exact strings are very important.
I also have no idea where to look to make such a change, and it would be very wide-ranging. I just think that the plaintext docs are currently a lossy medium and we should work to improve that.
Thanks,
-Stolee
Re: Rendering back-ticks in plaintext docs (was Re: [PATCH] git-rebase.txt: use back-ticks consistently)
Quoted 7 lines · Derrick Stolee
Quoted 2 lines
I see Phillip spotted some of this already, but the "exec" change here looks unwanted, i.e. let's use double quotes there.
This is definitely an issue where I was looking at the HTML formatted output, which respects back-ticks. Thanks for pointing out that the text docs just ignore back-ticks. This seems problematic, in my opinion.
Quoted 7 lines
Is it possible to update our doc formatting to convert back-ticks into something like single quotes? That would help these plain-text documents point out these places where exact strings are very important.
I also have no idea where to look to make such a change, and it would be very wide-ranging. I just think that the plaintext docs are currently a lossy medium and we should work to improve that.
Looking at "man -l git-rebase.1" output, not the "doc-diff" output that renders to pure plain text by deliberately losing font information in the roff output, I think this change is OK. IOW, "git help -m rebase" shows these marked-up parts in bold on the terminal (and on the paper, but who prints manual pages theres days?), which is what we want.
If there is something we found in this episode that we might want to improve, it is doc-diff, I would think.
Thanks.
Quoted 9 lines · Derrick Stolee via GitGitGadget
I can see splitting it up in a few ways, but I wanted to check to first see if that was necessary. If it is, then here are the strategies I considered:
1. Focus on type of update. This would mean a change for adding back-ticks on all --<option> text, adding back-ticks on all "git rebase" instances, adding back-ticks on things like <upstream>, and doing other types of changes like whitespace updates or "git-rebase" to "git rebase".
Unless each of these steps can be verified mechanically, I do not think it is worth it. If I have to choose between reading (1) 700+ line patch just once in the form as-posted, or (2) three 400+ line patches along the "type/theme", the choice is fairly simple and obvious.
Quoted 2 lines
2. Focus on the section of the document. This would limit the diff by the section size, such as OPTIONS or the discussion on the backends.
This could work, but the reviewers can choose where to stop if they feel that a 700+ line patch is a bit too much to read through in a single sitting themselves.
Quoted 8 lines
3. Focus on the edits that most-recently edited these lines. Doing some scripting, I was able to construct this date-sorted list of previous edits (by diffing the git blame output before and after this change). The most-recent changes before this are:
2005-08-26:
52a22d1e726([PATCH] Subject: [PATCH] Add some documentation., 2005-08-26)
...2022-04-20: 9e5ebe9668a (rebase: use correct base for --keep-base when a branch is given, 2022-04-20)
That is a new concept ;-)
It is an interesting exercise to see which previous changes had these mark-up mistakes, but it is not immediately obvious to me how we can take advantage of the information.
Quoted 2 lines
I look forward to feedback on how to do this better (if it is indeed a good idea to do in the first place).
Correcting mark-up to result in an easier-to-read documentation is a good idea, of course. I wonder if we can also help the developers mark-up correctly in their first attempt (e.g. do we have clear and concise guidelines that are well publicized?)
Quoted 28 lines
Documentation/git-rebase.txt | 224 +++++++++++++++++------------------ 1 file changed, 112 insertions(+), 112 deletions(-)Documentation/git-rebase.txt +6
-6@@ -348,10 +348,10 @@ See also INCOMPATIBLE OPTIONS below. Using merging strategies to rebase (default). + Note that a rebase merge works by replaying each commit from the working -branch on top of the <upstream> branch. Because of this, when a merge +branch on top of the `<upstream>` branch. Because of this, when a merge conflict happens, the side reported as 'ours' is the so-far rebased -series, starting with <upstream>, and 'theirs' is the working branch. In -other words, the sides are swapped. +series, starting with `<upstream>`, and 'theirs' is the working branch. +In other words, the sides are swapped. + See also INCOMPATIBLE OPTIONS below.@@ -360,9 +360,9 @@ See also INCOMPATIBLE OPTIONS below. Use the given merge strategy, instead of the default `ort`. This implies `--merge`. + -Because 'git rebase' replays each commit from the working branch -on top of the <upstream> branch using the given strategy, using -the 'ours' strategy simply empties all patches from the <branch>, +Because `git rebase` replays each commit from the working branch +on top of the `<upstream>` branch using the given strategy, using +the `ours` strategy simply empties all patches from the `<branch>`, which makes little sense.
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below.
Quoted 10 lines
Documentation/git-rebase.txt +2
-2+ See also INCOMPATIBLE OPTIONS below. --strategy-option=<strategy-option>:: Pass the <strategy-option> through to the merge strategy. This implies `--merge` and, if no strategy has been - specified, `-s ort`. Note the reversal of 'ours' and - 'theirs' as noted above for the `-m` option. + specified, `-s ort`. Note the reversal of `ours` and + `theirs` as noted above for the `-m` option.
These references to "ours" and "theirs" is what we called out earlier in the "swapped" description (hunk -348,10), i.e.
when a merge conflict happens, the side reported as 'ours' is the so-far rebased series ... and 'theirs' is the working branch.
which the patch left in 'emphasis' not verbatim. I think this section should do the same.
The 'ours' (but not 'theirs' because there is no such thing) that is explained as useless as a strategy in the intervening paragraph (hunk -360,9) refers to the name of a strategy, and it is correct to mark it as verbatim.
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 470
Quoted 12 lines
--ignore-whitespace::
Documentation/git-rebase.txt +4
-4Ignore whitespace differences when trying to reconcile -differences. Currently, each backend implements an approximation of -this behavior: + differences. Currently, each backend implements an approximation of + this behavior: + -apply backend: When applying a patch, ignore changes in whitespace in +'apply backend:' When applying a patch, ignore changes in whitespace in -merge backend: Treat lines with only whitespace changes as unchanged +'merge backend:' Treat lines with only whitespace changes as unchanged
It somehow looks curious (at the source level---I haven't seen the formatted HTML output) to have the punctuation colon as part of the phrase marked up. I wonder if these were meant to be more like so:
apply backend;; When applying a patch, ... merge backend;; Treat lines with ...
Documentation/git-rebase.txt See also REBASING MERGES and INCOMPATIBLE OPTIONS below. · line 542
Quoted 10 lines
Documentation/git-rebase.txt +2
-2@@ -536,8 +536,8 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: - Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + Append `exec <cmd>` after each line creating a commit in the + final history. `<cmd>` will be interpreted as one or more shell commands. Any command that fails will interrupt the rebase, with exit code 1.
As noticed by others, "git help -m rebase" is somewhat harmed with this change when rendered to plain text without any attributes. The roff output actually is
.RS 4
Append
\fBexec <cmd>\fR
after each line creating a commit in the final history\&.
and even on plain text tty, "exec <cmd>" part is now shown in bold (as opposed to be in plain text inside double quotes, which was how the original got rendered). So I think this change is an improvement.
Documentation/git-rebase.txt or by giving more than one `--exec`: · line 553
Quoted 6 lines
Documentation/git-rebase.txt +1
-1@@ -550,7 +550,7 @@ or by giving more than one `--exec`: + git rebase -i --exec "cmd1" --exec "cmd2" --exec ... + -If `--autosquash` is used, "exec" lines will not be appended for +If `--autosquash` is used, `exec` lines will not be appended for
Likewise.
Thanks.
Quoted 11 lines · Junio C Hamano
Quoted 8 lines · Derrick Stolee via GitGitGadget
3. Focus on the edits that most-recently edited these lines. Doing some scripting, I was able to construct this date-sorted list of previous edits (by diffing the git blame output before and after this change). The most-recent changes before this are:
2005-08-26:
52a22d1e726([PATCH] Subject: [PATCH] Add some documentation., 2005-08-26)
...2022-04-20: 9e5ebe9668a (rebase: use correct base for --keep-base when a branch is given, 2022-04-20)
Quoted 5 lines
That is a new concept ;-)
It is an interesting exercise to see which previous changes had these mark-up mistakes, but it is not immediately obvious to me how we can take advantage of the information.
I just wanted to see how much of these edits were due to "really old documentation from when we had different habits" and how many were related to recent updates, so I should give more pause. I think the discussion about the "apply" versus "merge" backends should have given me more pause because those sections were written recently and are more likely to have correct punctuation.
Quoted 7 lines
Quoted 2 lines
I look forward to feedback on how to do this better (if it is indeed a good idea to do in the first place).
Correcting mark-up to result in an easier-to-read documentation is a good idea, of course. I wonder if we can also help the developers mark-up correctly in their first attempt (e.g. do we have clear and concise guidelines that are well publicized?)
I'm not sure we have them well publicized. It's worth thinking about.
Hopefully creating a more standard use within at least one (long) file will help establish some patterns organically.
Quoted 15 lines
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 375
Quoted 7 lines
--strategy-option=<strategy-option>::
Documentation/git-rebase.txt +2
-2Pass the <strategy-option> through to the merge strategy. This implies `--merge` and, if no strategy has been - specified, `-s ort`. Note the reversal of 'ours' and - 'theirs' as noted above for the `-m` option. + specified, `-s ort`. Note the reversal of `ours` and + `theirs` as noted above for the `-m` option.These references to "ours" and "theirs" is what we called out earlier in the "swapped" description (hunk -348,10), i.e.
when a merge conflict happens, the side reported as 'ours' is the so-far rebased series ... and 'theirs' is the working branch.
Quoted 7 lines
which the patch left in 'emphasis' not
verbatim. I think this section should do the same.The 'ours' (but not 'theirs' because there is no such thing) that is explained as useless as a strategy in the intervening paragraph (hunk -360,9) refers to the name of a strategy, and it is correct to mark it as
verbatim.
Thanks!
Quoted 17 lines
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 470
Quoted 12 lines
--ignore-whitespace::
Documentation/git-rebase.txt +4
-4Ignore whitespace differences when trying to reconcile -differences. Currently, each backend implements an approximation of -this behavior: + differences. Currently, each backend implements an approximation of + this behavior: + -apply backend: When applying a patch, ignore changes in whitespace in +'apply backend:' When applying a patch, ignore changes in whitespace in -merge backend: Treat lines with only whitespace changes as unchanged +'merge backend:' Treat lines with only whitespace changes as unchangedIt somehow looks curious (at the source level---I haven't seen the formatted HTML output) to have the punctuation colon as part of the phrase marked up. I wonder if these were meant to be more like so:
Quoted 5 lines
apply backend;; When applying a patch, ... merge backend;; Treat lines with ...
This appears to work well. The doc-diff shows this:
- apply backend: When applying a patch, ignore changes in whitespace - in context lines. Unfortunately, this means that if the "old" lines - being replaced by the patch differ only in whitespace from the - existing file, you will get a merge conflict instead of a - successful patch application. + apply backend: + When applying a patch, ignore changes in whitespace in context + lines. Unfortunately, this means that if the "old" lines being + replaced by the patch differ only in whitespace from the + existing file, you will get a merge conflict instead of a + successful patch application.
- merge backend: Treat lines with only whitespace changes as - unchanged when merging. Unfortunately, this means that any patch - hunks that were intended to modify whitespace and nothing else will - be dropped, even if the other side had no changes that conflicted. + merge backend: + Treat lines with only whitespace changes as unchanged when + merging. Unfortunately, this means that any patch hunks that + were intended to modify whitespace and nothing else will be + dropped, even if the other side had no changes that conflicted.
Quoted 20 lines
Documentation/git-rebase.txt See also REBASING MERGES and INCOMPATIBLE OPTIONS below. · line 542
Quoted 10 lines
Documentation/git-rebase.txt +2
-2@@ -536,8 +536,8 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: - Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + Append `exec <cmd>` after each line creating a commit in the + final history. `<cmd>` will be interpreted as one or more shell commands. Any command that fails will interrupt the rebase, with exit code 1.As noticed by others, "git help -m rebase" is somewhat harmed with this change when rendered to plain text without any attributes. The roff output actually is
.RS 4
Append
\fBexec <cmd>\fR
after each line creating a commit in the final history\&.
Quoted 4 lines
and even on plain text tty, "exec <cmd>" part is now shown in bold (as opposed to be in plain text inside double quotes, which was how the original got rendered). So I think this change is an improvement.
Thanks for digging into the details here. It would be interesting if doc-diff could make this clearer, but that's a project for another time.
Thanks,
-Stolee
PATCH v2 1/1 git-rebase.txt: use back-ticks consistently
In reply to Derrick Stolee via GitGitGadgetFrom: Derrick Stolee <[email protected]>
While inspecting the 'git rebase' documentation, I noticed that it is inconsistent with how it uses back-ticks (or other punctuation) for identifying Git commands, command-line arguments, or values for those arguments.
Sometimes, an argument (like '--interactive') would appear without any punctuation, causing the argument to not have any special formatting. Other times, arguments or 'git rebase' itself would have single-quotes giving a bold look (in the HTML documentation at least).
By consistently using back-ticks, these types of strings appear in a monospace font with special highlighting to appear more clearly as text that exists in a command-line invocation of a Git command.
This rather-large diff is the result of scanning git-rebase.txt and adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
There are also a few minor cleanups in the process, including those found by reviwers.
---
git-rebase.txt: use back-ticks consistently
While I noticed this inconsistency when looking at git rebase as part of the git rebase --update-refs work, I didn't know the best way to update the document from start to finish.
Feedback tells me that splitting this patch isn't worth it.
Updates in v2
=============
* The 'apply' and 'merge' backends are now quoted with single quotes instead of back-ticks. (Phrases such as "the merge command" describing the todo file still use back-ticks.)
* The pre-rebase hook now has back-ticks.
* An unnecessary comma is removed.
* When talking about 'ours' and 'theirs' as "sides" of a rebase, use single quotes. Use back-ticks only for the ours strategy.
* A bulleted list is converted to use ";;" syntax.
Thanks, -Stolee
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1270%2Fderrickstolee%2Frebase-docs-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1270/derrickstolee/rebase-docs-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1270
Range-diff vs v1:
1: 71520dc1b71 ! 1: 02983cdb79d git-rebase.txt: use back-ticks consistently
@@ Commit message
adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
- There are also a few minor cleanups in the process, such as one place
- that did not use tabs for the first paragraph in a bulletted list.
- Another case still referred to the dashed form, but it was the only use
- in the file except for the heading and NAME section.
+ There are also a few minor cleanups in the process, including those
+ found by reviwers.
+ Helped-by: Phillip Wood <[email protected]>
+ Helped-by: Junio C Hamano <[email protected]>
## Documentation/git-rebase.txt ##
@@ Documentation/git-rebase.txt: SYNOPSIS
-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
-+The current branch is reset to <upstream>, or <newbase> if the ++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.
@@ Documentation/git-rebase.txt: SYNOPSIS
Assume the following history exists and the current branch is "topic":
+@@ Documentation/git-rebase.txt: 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 +-will be skipped and warnings will be issued (if the merge backend is ++will be skipped and warnings will be issued (if the 'merge' backend is
+ used). For example, running git rebase master on the following
+ history (in which A' and A introduce the same set of changes, but
+ have different committer information):
@@ Documentation/git-rebase.txt: would result in the removal of commits F and G:
------------
@@ Documentation/git-rebase.txt: flag exists as a convenient shortcut, such as for
+
See also INCOMPATIBLE OPTIONS below.
+@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
+ By default (or if --no-reapply-cherry-picks is given), these commits
+ will be automatically dropped. Because this necessitates reading all
+ upstream commits, this can be expensive in repos with a large number +-of upstream commits that need to be read. When using the merge ++of upstream commits that need to be read. When using the 'merge'
+ backend, warnings will be issued for each dropped commit (unless
+ --quiet is given). Advice will also be issued unless
+ advice.skippedCherryPicks is set to false (see linkgit:git-config[1]). @@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below. Using merging strategies to rebase (default).
+
@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
which makes little sense.
+
See also INCOMPATIBLE OPTIONS below.
-@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
- --strategy-option=<strategy-option>::
- Pass the <strategy-option> through to the merge strategy.
- This implies --merge and, if no strategy has been
-- specified, -s ort. Note the reversal of 'ours' and
-- 'theirs' as noted above for the -m option.
-+ specified, -s ort. Note the reversal of ours and
-+ theirs as noted above for the -m option.
- +
- See also INCOMPATIBLE OPTIONS below.
-
@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
-q::
@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
+ this behavior:
+
-apply backend: When applying a patch, ignore changes in whitespace in
-+'apply backend:' When applying a patch, ignore changes in whitespace in
- context lines. Unfortunately, this means that if the "old" lines being
- replaced by the patch differ only in whitespace from the existing
- file, you will get a merge conflict instead of a successful patch
- application.
+-context lines. Unfortunately, this means that if the "old" lines being +-replaced by the patch differ only in whitespace from the existing +-file, you will get a merge conflict instead of a successful patch +-application.
++apply backend:;;
++ When applying a patch, ignore changes in whitespace in context
++ lines. Unfortunately, this means that if the "old" lines being
++ replaced by the patch differ only in whitespace from the existing
++ file, you will get a merge conflict instead of a successful patch
++ application.
+
-merge backend: Treat lines with only whitespace changes as unchanged
-+'merge backend:' Treat lines with only whitespace changes as unchanged
- when merging. Unfortunately, this means that any patch hunks that were
- intended to modify whitespace and nothing else will be dropped, even
- if the other side had no changes that conflicted.
+-when merging. Unfortunately, this means that any patch hunks that were +-intended to modify whitespace and nothing else will be dropped, even +-if the other side had no changes that conflicted.
++merge backend:;;
++ Treat lines with only whitespace changes as unchanged when merging.
++ Unfortunately, this means that any patch hunks that were intended
++ to modify whitespace and nothing else will be dropped, even if the
++ other side had no changes that conflicted.
--whitespace=<option>::
- This flag is passed to the 'git apply' program
@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
See also INCOMPATIBLE OPTIONS below.
@@ Documentation/git-rebase.txt: See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
-
-x <cmd>::
--exec <cmd>::
-- Append "exec <cmd>" after each line creating a commit in the
+ Append "exec <cmd>" after each line creating a commit in the
- final history. <cmd> will be interpreted as one or more shell
-+ Append exec <cmd> after each line creating a commit in the
+ final history. <cmd> will be interpreted as one or more shell
commands. Any command that fails will interrupt the rebase,
with exit code 1.
@@ Documentation/git-rebase.txt: In addition, the following pairs of options are in
-git rebase has two primary backends: apply and merge. (The apply -backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge
-+git rebase has two primary backends: apply and merge. (The apply ++git rebase has two primary backends: 'apply' and 'merge'. (The 'apply'
+backend used to be known as the am backend, but the name led to
-+confusion as it looks like a verb instead of a noun. Also, the merge ++confusion as it looks like a verb instead of a noun. Also, the 'merge'
backend used to be known as the interactive backend, but it is now
used for non-interactive cases as well. Both were renamed based on lower-level functionality that underpinned each.) There are some
@@ Documentation/git-rebase.txt: subtle differences in how these two backends behav
~~~~~~~~~~~~~
-The apply backend unfortunately drops intentionally empty commits, i.e.
-+The apply backend unfortunately drops intentionally empty commits, i.e. ++The 'apply' backend unfortunately drops intentionally empty commits, i.e.
commits that started empty, though these are rare in practice. It also drops commits that become empty and has no option for controlling this behavior.
@@ Documentation/git-rebase.txt: subtle differences in how these two backends behav
-The merge backend keeps intentionally empty commits by default (though -with -i they are marked as empty in the todo list editor, or they can -be dropped automatically with --no-keep-empty).
-+The merge backend keeps intentionally empty commits by default (though ++The 'merge' backend keeps intentionally empty commits by default (though
+with -i they are marked as empty in the todo list editor, or they can +be dropped automatically with --no-keep-empty).
@@ Documentation/git-rebase.txt: Directory rename detection
Due to the lack of accurate tree information (arising from constructing fake ancestors with the limited information available in
-patches), directory rename detection is disabled in the apply backend.
-+patches), directory rename detection is disabled in the apply backend. ++patches), directory rename detection is disabled in the 'apply' backend.
Disabled directory rename detection means that if one side of history renames a directory and the other adds new files to the old directory, then the new files will be left behind in the old directory without
@@ Documentation/git-rebase.txt: Directory rename detection
files into the new directory.
-Directory rename detection works with the merge backend to provide you
-+Directory rename detection works with the merge backend to provide you ++Directory rename detection works with the 'merge' backend to provide you
warnings in such cases.
Context
~~~~~~~
-The apply backend works by creating a sequence of patches (by calling
-+The apply backend works by creating a sequence of patches (by calling ++The 'apply' backend works by creating a sequence of patches (by calling
format-patch internally), and then applying the patches in sequence (calling am internally). Patches are composed of multiple hunks, each with line numbers, a context region, and the actual changes. The
@@ Documentation/git-rebase.txt: order to apply the changes to the right lines. Ho
will require more lines of matching context to apply).
-The merge backend works with a full copy of each relevant file,
-+The merge backend works with a full copy of each relevant file, ++The 'merge' backend works with a full copy of each relevant file,
insulating it from these types of problems.
Labelling of conflicts markers
@@ Documentation/git-rebase.txt: Labelling of conflicts markers
When there are content conflicts, the merge machinery tries to annotate each side's conflict markers with the commits where the
-content came from. Since the apply backend drops the original
-+content came from. Since the apply backend drops the original ++content came from. Since the 'apply' backend drops the original
information about the rebased commits and their parents (and instead generates new fake commits based off limited information in the generated patches), those commits cannot be identified; instead it has
-to fall back to a commit summary. Also, when merge.conflictStyle is -set to diff3 or zdiff3, the apply backend will use "constructed merge +to fall back to a commit summary. Also, when merge.conflictStyle is
-+set to diff3 or zdiff3, the apply backend will use "constructed merge ++set to diff3 or zdiff3, the 'apply' backend will use "constructed merge
base" to label the content from the merge base, and thus provide no information about the merge base commit whatsoever.
-The merge backend works with the full commits on both sides of history
-+The merge backend works with the full commits on both sides of history ++The 'merge' backend works with the full commits on both sides of history
and thus has no such limitations.
Hooks
@@ Documentation/git-rebase.txt: Labelling of conflicts markers
-The apply backend has not traditionally called the post-commit hook, -while the merge backend has. Both have called the post-checkout hook, -though the merge backend has squelched its output. Further, both
-+The apply backend has not traditionally called the post-commit hook, -+while the merge backend has. Both have called the post-checkout hook, -+though the merge backend has squelched its output. Further, both ++The 'apply' backend has not traditionally called the post-commit hook, ++while the 'merge' backend has. Both have called the post-checkout hook, ++though the 'merge' backend has squelched its output. Further, both
backends only call the post-checkout hook with the starting point commit of the rebase, not the intermediate commits nor the final commit. In each case, the calling of these hooks was by accident of
@@ Documentation/git-rebase.txt: calling either of these hooks in the future.
~~~~~~~~~~~~~~~~
-The apply backend has safety problems with an ill-timed interrupt; if
-+The apply backend has safety problems with an ill-timed interrupt; if ++The 'apply' backend has safety problems with an ill-timed interrupt; if
the user presses Ctrl-C at the wrong time to try to abort the rebase, the rebase can enter a state where it cannot be aborted with a
-subsequent git rebase --abort. The merge backend does not appear to
-+subsequent git rebase --abort. The merge backend does not appear to ++subsequent git rebase --abort. The 'merge' backend does not appear to
suffer from the same shortcoming. (See
https://lore.kernel.org/git/[email protected]/ for details.)
@@ Documentation/git-rebase.txt: When a conflict occurs while rebasing, rebase stop
git rebase --continue, the rebase should open an editor and ask the
-user to update the commit message. The merge backend does this, while -the apply backend blindly applies the original commit message.
-+user to update the commit message. The merge backend does this, while -+the apply backend blindly applies the original commit message. ++user to update the commit message. The 'merge' backend does this, while ++the 'apply' backend blindly applies the original commit message.
Miscellaneous differences
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ Documentation/git-rebase.txt: completeness:
below.
-When the git-rebase command is run, it will first execute a "pre-rebase"
-+When the git rebase command is run, it will first execute a "pre-rebase"
- hook if one exists. You can use this hook to do sanity checks and
- reject the rebase if it isn't appropriate. Please see the template
- pre-rebase hook script for an example.
+-hook if one exists. You can use this hook to do sanity checks and +-reject the rebase if it isn't appropriate. Please see the template +-pre-rebase hook script for an example.
++When the rebase is run, it will first execute a pre-rebase hook if one ++exists. You can use this hook to do sanity checks and reject the rebase ++if it isn't appropriate. Please see the template pre-rebase hook script ++for an example.
-Upon completion, <branch> will be the current branch. +Upon completion, <branch> will be the current branch.
Documentation/git-rebase.txt | 244 ++++++++++++++++++----------------- 1 file changed, 123 insertions(+), 121 deletions(-)
Documentation/git-rebase.txt +123 -121
@@ -16,40 +16,40 @@ SYNOPSIS DESCRIPTION ----------- -If <branch> is specified, 'git rebase' will perform an automatic +If `<branch>` is specified, `git rebase` will perform an automatic `git switch <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 +If `<upstream>` is not specified, the upstream configured in +`branch.<name>.remote` and `branch.<name>.merge` options will be used (see linkgit: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 +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 +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 +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. +original `<branch>` and remove the `.git/rebase-apply` working files, use +the command `git rebase --abort` instead. Assume the following history exists and the current branch is "topic":
@@ -79,7 +79,7 @@ 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 -will be skipped and warnings will be issued (if the `merge` backend is +will be skipped and warnings will be issued (if the 'merge' backend is used). For example, running `git rebase master` on the following history (in which `A'` and `A` introduce the same set of changes, but have different committer information):
@@ -176,11 +176,11 @@ would result in the removal of commits F and G: ------------ 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 <upstream> +part of topicA. Note that the argument to `--onto` and the `<upstream>` 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
@@ -205,8 +205,8 @@ OPTIONS ------- --onto <newbase>:: 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 + `--onto` option is not specified, the starting point is + `<upstream>`. 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
@@ -215,19 +215,19 @@ leave out at most one of A and B, in which case it defaults to HEAD. --keep-base:: Set the starting point at which to create the new commits to the - merge base of <upstream> and <branch>. Running - 'git rebase --keep-base <upstream> <branch>' is equivalent to + merge base of `<upstream>` and `<branch>`. Running + `git rebase --keep-base <upstream> <branch>` is equivalent to running - 'git rebase --onto <upstream>...<branch> <upstream> <branch>'. + `git rebase --onto <upstream>...<branch> <upstream> <branch>`. + This option is useful in the case where one is developing a feature on top of an upstream branch. While the feature is being worked on, the upstream branch may advance and it may not be the best idea to keep rebasing on top of the upstream but to keep the base commit as-is. + -Although both this option and --fork-point find the merge base between -<upstream> and <branch>, this option uses the merge base as the _starting -point_ on which new commits will be created, whereas --fork-point uses +Although both this option and `--fork-point` find the merge base between +`<upstream>` and `<branch>`, this option uses the merge base as the _starting +point_ on which new commits will be created, whereas `--fork-point` uses the merge base to determine the _set of commits_ which will be rebased. + See also INCOMPATIBLE OPTIONS below.
@@ -238,23 +238,23 @@ See also INCOMPATIBLE OPTIONS below. upstream for the current branch. <branch>:: - Working branch; defaults to HEAD. + Working branch; defaults to `HEAD`. --continue:: Restart the rebasing process after having resolved a merge conflict. --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 + 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. --quit:: - Abort the rebase operation but HEAD is not reset back to the + 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. If a temporary stash entry was created - using --autostash, it will be saved to the stash list. + using `--autostash`, it will be saved to the stash list. --apply:: Use applying strategies to rebase (calling `git-am`
@@ -269,16 +269,16 @@ See also INCOMPATIBLE OPTIONS below. empty after rebasing (because they contain a subset of already upstream changes). With drop (the default), commits that become empty are dropped. With keep, such commits are kept. - With ask (implied by --interactive), the rebase will halt when + With ask (implied by `--interactive`), the rebase will halt when an empty commit is applied allowing you to choose whether to drop it, edit files more, or just commit the empty changes. - Other options, like --exec, will use the default of drop unless - -i/--interactive is explicitly specified. + Other options, like `--exec`, will use the default of drop unless + `-i`/`--interactive` is explicitly specified. + -Note that commits which start empty are kept (unless --no-keep-empty +Note that commits which start empty are kept (unless `--no-keep-empty` is specified), and commits which are clean cherry-picks (as determined by `git log --cherry-mark ...`) are detected and dropped as a -preliminary step (unless --reapply-cherry-picks is passed). +preliminary step (unless `--reapply-cherry-picks` is passed). + See also INCOMPATIBLE OPTIONS below.
@@ -287,7 +287,7 @@ See also INCOMPATIBLE OPTIONS below. Do not keep commits that start empty before the rebase (i.e. that do not change anything from its parent) in the result. The default is to keep commits which start empty, - since creating such commits requires passing the --allow-empty + since creating such commits requires passing the `--allow-empty` override flag to `git commit`, signifying that a user is very intentionally creating such a commit and thus wants to keep it.
@@ -299,7 +299,7 @@ flag exists as a convenient shortcut, such as for cases where external tools generate many empty commits and you want them all removed. + For commits which do not start empty but become empty after rebasing, -see the --empty flag. +see the `--empty` flag. + See also INCOMPATIBLE OPTIONS below.
@@ -314,7 +314,7 @@ See also INCOMPATIBLE OPTIONS below. By default (or if `--no-reapply-cherry-picks` is given), these commits will be automatically dropped. Because this necessitates reading all upstream commits, this can be expensive in repos with a large number -of upstream commits that need to be read. When using the `merge` +of upstream commits that need to be read. When using the 'merge' backend, warnings will be issued for each dropped commit (unless `--quiet` is given). Advice will also be issued unless `advice.skippedCherryPicks` is set to false (see linkgit:git-config[1]).
@@ -348,10 +348,10 @@ See also INCOMPATIBLE OPTIONS below. Using merging strategies to rebase (default). + Note that a rebase merge works by replaying each commit from the working -branch on top of the <upstream> branch. Because of this, when a merge +branch on top of the `<upstream>` branch. Because of this, when a merge conflict happens, the side reported as 'ours' is the so-far rebased -series, starting with <upstream>, and 'theirs' is the working branch. In -other words, the sides are swapped. +series, starting with `<upstream>`, and 'theirs' is the working branch. +In other words, the sides are swapped. + See also INCOMPATIBLE OPTIONS below.
@@ -360,9 +360,9 @@ See also INCOMPATIBLE OPTIONS below. Use the given merge strategy, instead of the default `ort`. This implies `--merge`. + -Because 'git rebase' replays each commit from the working branch -on top of the <upstream> branch using the given strategy, using -the 'ours' strategy simply empties all patches from the <branch>, +Because `git rebase` replays each commit from the working branch +on top of the `<upstream>` branch using the given strategy, using +the `ours` strategy simply empties all patches from the `<branch>`, which makes little sense. + See also INCOMPATIBLE OPTIONS below.
@@ -392,11 +392,11 @@ See also INCOMPATIBLE OPTIONS below. -q:: --quiet:: - Be quiet. Implies --no-stat. + Be quiet. Implies `--no-stat`. -v:: --verbose:: - Be verbose. Implies --stat. + Be verbose. Implies `--stat`. --stat:: Show a diffstat of what changed upstream since the last rebase. The
@@ -411,13 +411,13 @@ See also INCOMPATIBLE OPTIONS below. --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]. + be used to override `--no-verify`. See also linkgit:githooks[5]. -C<n>:: - Ensure at least <n> lines of surrounding context match before + 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. Implies --apply. + ever ignored. Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.
@@ -436,21 +436,21 @@ details). --fork-point:: --no-fork-point:: - Use reflog to find a better common ancestor between <upstream> - and <branch> when calculating which commits have been - introduced by <branch>. + Use reflog to find a better common ancestor between `<upstream>` + and `<branch>` when calculating which commits have been + introduced by `<branch>`. + -When --fork-point is active, 'fork_point' will be used instead of -<upstream> to calculate the set of commits to rebase, where +When `--fork-point` is active, 'fork_point' will be used instead of +`<upstream>` to calculate the set of commits to rebase, where 'fork_point' is the result of `git merge-base --fork-point <upstream> <branch>` command (see linkgit:git-merge-base[1]). If 'fork_point' -ends up being empty, the <upstream> will be used as a fallback. +ends up being empty, the `<upstream>` will be used as a fallback. + -If <upstream> is given on the command line, then the default is +If `<upstream>` is given on the command line, then the default is `--no-fork-point`, otherwise the default is `--fork-point`. See also `rebase.forkpoint` in linkgit:git-config[1]. + -If your branch was based on <upstream> but <upstream> was rewound and +If your branch was based on `<upstream>` but `<upstream>` was rewound and your branch contains commits which were dropped, this option can be used with `--keep-base` in order to drop those commits from your branch. +
@@ -458,24 +458,26 @@ See also INCOMPATIBLE OPTIONS below. --ignore-whitespace:: Ignore whitespace differences when trying to reconcile -differences. Currently, each backend implements an approximation of -this behavior: + differences. Currently, each backend implements an approximation of + this behavior: + -apply backend: When applying a patch, ignore changes in whitespace in -context lines. Unfortunately, this means that if the "old" lines being -replaced by the patch differ only in whitespace from the existing -file, you will get a merge conflict instead of a successful patch -application. +apply backend:;; + When applying a patch, ignore changes in whitespace in context + lines. Unfortunately, this means that if the "old" lines being + replaced by the patch differ only in whitespace from the existing + file, you will get a merge conflict instead of a successful patch + application. + -merge backend: Treat lines with only whitespace changes as unchanged -when merging. Unfortunately, this means that any patch hunks that were -intended to modify whitespace and nothing else will be dropped, even -if the other side had no changes that conflicted. +merge backend:;; + Treat lines with only whitespace changes as unchanged when merging. + Unfortunately, this means that any patch hunks that were intended + to modify whitespace and nothing else will be dropped, even if the + other side had no changes that conflicted. --whitespace=<option>:: - This flag is passed to the 'git apply' program + This flag is passed to the `git apply` program (see linkgit:git-apply[1]) that applies the patch. - Implies --apply. + Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.
@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + final history. `<cmd>` will be interpreted as one or more shell commands. Any command that fails will interrupt the rebase, with exit code 1. +
@@ -550,7 +552,7 @@ or by giving more than one `--exec`: + git rebase -i --exec "cmd1" --exec "cmd2" --exec ... + -If `--autosquash` is used, "exec" lines will not be appended for +If `--autosquash` is used, `exec` lines will not be appended for the intermediate commits, and will only appear at the end of each squash/fixup series. +
@@ -560,11 +562,12 @@ without an explicit `--interactive`. See also INCOMPATIBLE OPTIONS below. --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. + 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. + See also INCOMPATIBLE OPTIONS below.
@@ -643,9 +646,9 @@ In addition, the following pairs of options are incompatible: BEHAVIORAL DIFFERENCES ----------------------- -git rebase has two primary backends: apply and merge. (The apply -backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +`git rebase` has two primary backends: 'apply' and 'merge'. (The 'apply' +backend used to be known as the `am` backend, but the name led to +confusion as it looks like a verb instead of a noun. Also, the 'merge' backend used to be known as the interactive backend, but it is now used for non-interactive cases as well. Both were renamed based on lower-level functionality that underpinned each.) There are some
@@ -654,19 +657,19 @@ subtle differences in how these two backends behave: Empty commits ~~~~~~~~~~~~~ -The apply backend unfortunately drops intentionally empty commits, i.e. +The 'apply' backend unfortunately drops intentionally empty commits, i.e. commits that started empty, though these are rare in practice. It also drops commits that become empty and has no option for controlling this behavior. -The merge backend keeps intentionally empty commits by default (though -with -i they are marked as empty in the todo list editor, or they can -be dropped automatically with --no-keep-empty). +The 'merge' backend keeps intentionally empty commits by default (though +with `-i` they are marked as empty in the todo list editor, or they can +be dropped automatically with `--no-keep-empty`). Similar to the apply backend, by default the merge backend drops -commits that become empty unless -i/--interactive is specified (in +commits that become empty unless `-i`/`--interactive` is specified (in which case it stops and asks the user what to do). The merge backend -also has an --empty={drop,keep,ask} option for changing the behavior +also has an `--empty={drop,keep,ask}` option for changing the behavior of handling commits that become empty. Directory rename detection
@@ -674,20 +677,20 @@ Directory rename detection Due to the lack of accurate tree information (arising from constructing fake ancestors with the limited information available in -patches), directory rename detection is disabled in the apply backend. +patches), directory rename detection is disabled in the 'apply' backend. Disabled directory rename detection means that if one side of history renames a directory and the other adds new files to the old directory, then the new files will be left behind in the old directory without any warning at the time of rebasing that you may want to move these files into the new directory. -Directory rename detection works with the merge backend to provide you +Directory rename detection works with the 'merge' backend to provide you warnings in such cases. Context ~~~~~~~ -The apply backend works by creating a sequence of patches (by calling +The 'apply' backend works by creating a sequence of patches (by calling `format-patch` internally), and then applying the patches in sequence (calling `am` internally). Patches are composed of multiple hunks, each with line numbers, a context region, and the actual changes. The
@@ -698,11 +701,11 @@ order to apply the changes to the right lines. However, if multiple areas of the code have the same surrounding lines of context, the wrong one can be picked. There are real-world cases where this has caused commits to be reapplied incorrectly with no conflicts reported. -Setting diff.context to a larger value may prevent such types of +Setting `diff.context` to a larger value may prevent such types of problems, but increases the chance of spurious conflicts (since it will require more lines of matching context to apply). -The merge backend works with a full copy of each relevant file, +The 'merge' backend works with a full copy of each relevant file, insulating it from these types of problems. Labelling of conflicts markers
@@ -710,30 +713,30 @@ Labelling of conflicts markers When there are content conflicts, the merge machinery tries to annotate each side's conflict markers with the commits where the -content came from. Since the apply backend drops the original +content came from. Since the 'apply' backend drops the original information about the rebased commits and their parents (and instead generates new fake commits based off limited information in the generated patches), those commits cannot be identified; instead it has -to fall back to a commit summary. Also, when merge.conflictStyle is -set to diff3 or zdiff3, the apply backend will use "constructed merge +to fall back to a commit summary. Also, when `merge.conflictStyle` is +set to `diff3` or `zdiff3`, the 'apply' backend will use "constructed merge base" to label the content from the merge base, and thus provide no information about the merge base commit whatsoever. -The merge backend works with the full commits on both sides of history +The 'merge' backend works with the full commits on both sides of history and thus has no such limitations. Hooks ~~~~~ -The apply backend has not traditionally called the post-commit hook, -while the merge backend has. Both have called the post-checkout hook, -though the merge backend has squelched its output. Further, both +The 'apply' backend has not traditionally called the post-commit hook, +while the 'merge' backend has. Both have called the post-checkout hook, +though the 'merge' backend has squelched its output. Further, both backends only call the post-checkout hook with the starting point commit of the rebase, not the intermediate commits nor the final commit. In each case, the calling of these hooks was by accident of implementation rather than by design (both backends were originally implemented as shell scripts and happened to invoke other commands -like 'git checkout' or 'git commit' that would call the hooks). Both +like `git checkout` or `git commit` that would call the hooks). Both backends should have the same behavior, though it is not entirely clear which, if any, is correct. We will likely make rebase stop calling either of these hooks in the future.
@@ -741,10 +744,10 @@ calling either of these hooks in the future. Interruptability ~~~~~~~~~~~~~~~~ -The apply backend has safety problems with an ill-timed interrupt; if +The 'apply' backend has safety problems with an ill-timed interrupt; if the user presses Ctrl-C at the wrong time to try to abort the rebase, the rebase can enter a state where it cannot be aborted with a -subsequent `git rebase --abort`. The merge backend does not appear to +subsequent `git rebase --abort`. The 'merge' backend does not appear to suffer from the same shortcoming. (See https://lore.kernel.org/git/[email protected]/ for details.)
@@ -756,8 +759,8 @@ When a conflict occurs while rebasing, rebase stops and asks the user to resolve. Since the user may need to make notable changes while resolving conflicts, after conflicts are resolved and the user has run `git rebase --continue`, the rebase should open an editor and ask the -user to update the commit message. The merge backend does this, while -the apply backend blindly applies the original commit message. +user to update the commit message. The 'merge' backend does this, while +the 'apply' backend blindly applies the original commit message. Miscellaneous differences ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -777,23 +780,23 @@ completeness: them to stderr. * State directories: The two backends keep their state in different - directories under .git/ + directories under `.git/` include::merge-strategies.txt[] NOTES ----- -You should understand the implications of using 'git rebase' on a +You should understand the implications of using `git rebase` on a repository that you share. See also RECOVERING FROM UPSTREAM REBASE below. -When the git-rebase command is run, it will first execute a "pre-rebase" -hook if one exists. You can use this hook to do sanity checks and -reject the rebase if it isn't appropriate. Please see the template -pre-rebase hook script for an example. +When the rebase is run, it will first execute a `pre-rebase` hook if one +exists. You can use this hook to do sanity checks and reject the rebase +if it isn't appropriate. Please see the template `pre-rebase` hook script +for an example. -Upon completion, <branch> will be the current branch. +Upon completion, `<branch>` will be the current branch. INTERACTIVE MODE ----------------
@@ -848,7 +851,7 @@ not look at them but at the commit names ("deadbee" and "fa1afe1" in this example), so do not delete or edit the names. By replacing the command "pick" with the command "edit", you can tell -'git rebase' to stop after applying that commit, so that you can edit +`git rebase` to stop after applying that commit, so that you can edit the files and/or the commit message, amend the commit, and continue rebasing.
@@ -876,14 +879,13 @@ commit, the message from the final one is used. You can also use "fixup -C" to get the same behavior as "fixup -c" except without opening an editor. - -'git rebase' will stop when "pick" has been replaced with "edit" or +`git rebase` will stop when "pick" has been replaced with "edit" or when a command fails due to merge errors. When you are done editing and/or resolving conflicts you can continue with `git rebase --continue`. For example, if you want to reorder the last 5 commits, such that what -was HEAD~4 becomes the new HEAD. To achieve that, you would call -'git rebase' like this: +was `HEAD~4` becomes the new `HEAD`. To achieve that, you would call +`git rebase` like this: ---------------------- $ git rebase -i HEAD~5
@@ -903,7 +905,7 @@ like this: ------------------ Suppose you want to rebase the side branch starting at "A" to "Q". Make -sure that the current HEAD is "B", and call +sure that the current `HEAD` is "B", and call ----------------------------- $ git rebase -i -r --onto Q O
@@ -956,23 +958,23 @@ SPLITTING COMMITS ----------------- In interactive mode, you can mark commits with the action "edit". However, -this does not necessarily mean that 'git rebase' expects the result of this +this does not necessarily mean that `git rebase` expects the result of this edit to be exactly one commit. Indeed, you can undo the commit, or you can add other commits. This can be used to split a commit into two: - Start an interactive rebase with `git rebase -i <commit>^`, where - <commit> is the commit you want to split. In fact, any commit range + `<commit>` is the commit you want to split. In fact, any commit range will do, as long as it contains that commit. - Mark the commit you want to split with the action "edit". - When it comes to editing that commit, execute `git reset HEAD^`. The - effect is that the HEAD is rewound by one, and the index follows suit. + effect is that the `HEAD` is rewound by one, and the index follows suit. However, the working tree stays the same. - Now add the changes to the index that you want to have in the first commit. You can use `git add` (possibly interactively) or - 'git gui' (or both) to do that. + `git gui` (or both) to do that. - Commit the now-current index with whatever commit message is appropriate now.
@@ -983,7 +985,7 @@ add other commits. This can be used to split a commit into two: If you are not absolutely sure that the intermediate revisions are consistent (they compile, pass the testsuite, etc.) you should use -'git stash' to stash away the not-yet-committed changes +`git stash` to stash away the not-yet-committed changes after each commit, test, and amend the commit if fixes are necessary.
@@ -1087,12 +1089,12 @@ NOTE: While an "easy case recovery" sometimes appears to be successful example, a commit that was removed via `git rebase --interactive` will be **resurrected**! -The idea is to manually tell 'git rebase' "where the old 'subsystem' +The idea is to manually tell `git rebase` "where the old 'subsystem' ended and your 'topic' began", that is, what the old merge base between them was. You will have to find a way to name the last commit of the old 'subsystem', for example: -* With the 'subsystem' reflog: after 'git fetch', the old tip of +* With the 'subsystem' reflog: after `git fetch`, the old tip of 'subsystem' is at `subsystem@{1}`. Subsequent fetches will increase the number. (See linkgit:git-reflog[1].)
base-commit: 9bef0b1e6ec371e786c2fba3edcc06ad040a536c
Signature · 1 line
gitgitgadget
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 464
Quoted 6 lines · Derrick Stolee via GitGitGadget
Documentation/git-rebase.txt +1
-5-apply backend: When applying a patch, ignore changes in whitespace in -context lines. Unfortunately, this means that if the "old" lines being -replaced by the patch differ only in whitespace from the existing -file, you will get a merge conflict instead of a successful patch -application. +apply backend:;;
Hmph, I am surprised that you took this, with an extra colon. Does it format nicely?
Quoted 26 lines
Documentation/git-rebase.txt +12
-6+ When applying a patch, ignore changes in whitespace in context + lines. Unfortunately, this means that if the "old" lines being + replaced by the patch differ only in whitespace from the existing + file, you will get a merge conflict instead of a successful patch + application. + -merge backend: Treat lines with only whitespace changes as unchanged -when merging. Unfortunately, this means that any patch hunks that were -intended to modify whitespace and nothing else will be dropped, even -if the other side had no changes that conflicted. +merge backend:;; + Treat lines with only whitespace changes as unchanged when merging. + Unfortunately, this means that any patch hunks that were intended + to modify whitespace and nothing else will be dropped, even if the + other side had no changes that conflicted. --whitespace=<option>:: - This flag is passed to the 'git apply' program + This flag is passed to the `git apply` program (see linkgit:git-apply[1]) that applies the patch. - Implies --apply. + Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.
Documentation/git-rebase.txt See also REBASING MERGES and INCOMPATIBLE OPTIONS below. · line 541
Quoted 3 lines
Documentation/git-rebase.txt +0
-0@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: Append "exec <cmd>" after each line creating a commit in the
I thought exec <cmd> was an improvement, just like ...
Documentation/git-rebase.txt or by giving more than one `--exec`: · line 555
Quoted 2 lines
Documentation/git-rebase.txt +1
-1-If `--autosquash` is used, "exec" lines will not be appended for +If `--autosquash` is used, `exec` lines will not be appended for
... this is?
Other than that, looking good.
Thanks.
Quoted 7 lines · Junio C Hamano
Documentation/git-rebase.txt See also REBASING MERGES and INCOMPATIBLE OPTIONS below. · line 541
Quoted 4 lines · Derrick Stolee via GitGitGadget
Documentation/git-rebase.txt +0
-0@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: Append "exec <cmd>" after each line creating a commit in theI thought
exec <cmd>was an improvement, just like ...
I'm not so sure, I thought we normally reserved backticks for command line options and this is talking about what gets added to the todo-list. I could see "exec <cmd>" being an improvement though. There are several other mentions of todo list commands in the documentation and I think they are all double quoted like this one.
Best Wishes
Phillip
Quoted 8 lines
Documentation/git-rebase.txt or by giving more than one `--exec`: · line 555
Quoted 2 lines
Documentation/git-rebase.txt +1
-1-If `--autosquash` is used, "exec" lines will not be appended for +If `--autosquash` is used, `exec` lines will not be appended for... this is?
Other than that, looking good.
Thanks.
Quoted 10 lines · Phillip Wood
Quoted 7 lines · Junio C Hamano
Quoted 4 lines · Derrick Stolee via GitGitGadget
(quoted diff) +0
-0@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.-x <cmd>::
--exec <cmd>::
Append "exec <cmd>" after each line creating a commit in theI thought
exec <cmd>was an improvement, just like ...I'm not so sure, I thought we normally reserved backticks for command line options and this is talking about what gets added to the todo-list. I could see "exec
<cmd>" being an improvement though. There are several other mentions of todo list commands in the documentation and I think they are all double quoted like this one.
This was my understanding based on the v1 feedback. I think it would be OK to consider this change separately, perhaps as an example case in a "recommended doc formatting" document.
Thanks,
-Stolee
Quoted 8 lines · Phillip Wood
Quoted 6 lines · Junio C Hamano
Documentation/git-rebase.txt See also REBASING MERGES and INCOMPATIBLE OPTIONS below. · line 541
Quoted 4 lines · Derrick Stolee via GitGitGadget
Documentation/git-rebase.txt +0
-0@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: Append "exec <cmd>" after each line creating a commit in theI thought
exec <cmd>was an improvement, just like ...
Quoted 5 lines
I'm not so sure, I thought we normally reserved backticks for command line options and this is talking about what gets added to the todo-list. I could see "exec
<cmd>" being an improvement though. There are several other mentions of todo list commands in the documentation and I think they are all double quoted like this one.
OK. Thanks for correcting me.
Quoted 11 lines · Junio C Hamano
Documentation/git-rebase.txt See also INCOMPATIBLE OPTIONS below. · line 464
Quoted 6 lines · Derrick Stolee via GitGitGadget
Documentation/git-rebase.txt +1
-5-apply backend: When applying a patch, ignore changes in whitespace in -context lines. Unfortunately, this means that if the "old" lines being -replaced by the patch differ only in whitespace from the existing -file, you will get a merge conflict instead of a successful patch -application. +apply backend:;;Hmph, I am surprised that you took this, with an extra colon. Does it format nicely?
Well, this is somewhat of an "oops" because I honestly thought you had kept the colons in your comment, but it turns out that I misread it.
I had replied with this doc-diff:
- apply backend: When applying a patch, ignore changes in whitespace - in context lines. Unfortunately, this means that if the "old" lines - being replaced by the patch differ only in whitespace from the - existing file, you will get a merge conflict instead of a - successful patch application. + apply backend: + When applying a patch, ignore changes in whitespace in context + lines. Unfortunately, this means that if the "old" lines being + replaced by the patch differ only in whitespace from the + existing file, you will get a merge conflict instead of a + successful patch application.
- merge backend: Treat lines with only whitespace changes as - unchanged when merging. Unfortunately, this means that any patch - hunks that were intended to modify whitespace and nothing else will - be dropped, even if the other side had no changes that conflicted. + merge backend: + Treat lines with only whitespace changes as unchanged when + merging. Unfortunately, this means that any patch hunks that + were intended to modify whitespace and nothing else will be + dropped, even if the other side had no changes that conflicted.
So, we do have a render that doesn't look awful, but since we already have formatting that makes it clear these are subsections, the colons are not needed.
Thanks,
-Stolee
Quoted 16 lines · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
While inspecting the 'git rebase' documentation, I noticed that it is inconsistent with how it uses back-ticks (or other punctuation) for identifying Git commands, command-line arguments, or values for those arguments.
Sometimes, an argument (like '--interactive') would appear without any punctuation, causing the argument to not have any special formatting. Other times, arguments or 'git rebase' itself would have single-quotes giving a bold look (in the HTML documentation at least).
By consistently using back-ticks, these types of strings appear in a monospace font with special highlighting to appear more clearly as text that exists in a command-line invocation of a Git command.
Quoted 6 lines
This rather-large diff is the result of scanning git-rebase.txt and adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
There are also a few minor cleanups in the process, including those found by reviwers.
Not worth a re-roll on its own: s/reviwers/reviewers/
Quoted 4 lines
Helped-by Phillip Wood <[email protected]>Helped-by Junio C Hamano <[email protected]>Signed-off-by Derrick Stolee <[email protected]>
This is looking good, I've one minor comment below
Documentation/git-rebase.txt In addition, the following pairs of options are incompatible: · line 650
Quoted 5 lines
Documentation/git-rebase.txt +2
-3-git rebase has two primary backends: apply and merge. (The apply -backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +`git rebase` has two primary backends: 'apply' and 'merge'. (The 'apply' +backend used to be known as the `am` backend, but the name led to
I think we should keep single quotes around "am" as it is being used as a name like 'apply'
Thanks again for cleaning up the documentation
Phillip
Quoted 5 lines · Phillip Wood
Quoted 2 lines · Derrick Stolee via GitGitGadget
There are also a few minor cleanups in the process, including those found by reviwers.
Not worth a re-roll on its own: s/reviwers/reviewers/
Thanks!
Quoted 7 lines
Documentation/git-rebase.txt In addition, the following pairs of options are incompatible: · line 650
Quoted 5 lines
Documentation/git-rebase.txt +2
-3-git rebase has two primary backends: apply and merge. (The apply -backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +`git rebase` has two primary backends: 'apply' and 'merge'. (The 'apply' +backend used to be known as the `am` backend, but the name led toI think we should keep single quotes around "am" as it is being used as a name like 'apply'
Thanks for your keen eye here. I searched the doc for all uses of "apply" and "merge" to evaluate this quoting, but missed this use of "am".
Thanks,
-Stolee
PATCH v3 1/1 git-rebase.txt: use back-ticks consistently
In reply to Derrick Stolee via GitGitGadgetFrom: Derrick Stolee <[email protected]>
While inspecting the 'git rebase' documentation, I noticed that it is inconsistent with how it uses back-ticks (or other punctuation) for identifying Git commands, command-line arguments, or values for those arguments.
Sometimes, an argument (like '--interactive') would appear without any punctuation, causing the argument to not have any special formatting. Other times, arguments or 'git rebase' itself would have single-quotes giving a bold look (in the HTML documentation at least).
By consistently using back-ticks, these types of strings appear in a monospace font with special highlighting to appear more clearly as text that exists in a command-line invocation of a Git command.
This rather-large diff is the result of scanning git-rebase.txt and adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
There are also a few minor cleanups in the process, including those found by reviewers.
---
git-rebase.txt: use back-ticks consistently
While I noticed this inconsistency when looking at git rebase as part of the git rebase --update-refs work, I didn't know the best way to update the document from start to finish.
Feedback tells me that splitting this patch isn't worth it.
Updates in v3
=============
* A much smaller round of edits, but huge thanks to Junio and Phillip for a careful attention to detail.
* Use 'am' over am.
* Don't use colons in subsection headings.
* Fix a commit message typo.
Updates in v2
=============
* The 'apply' and 'merge' backends are now quoted with single quotes instead of back-ticks. (Phrases such as "the merge command" describing the todo file still use back-ticks.)
* The pre-rebase hook now has back-ticks.
* An unnecessary comma is removed.
* When talking about 'ours' and 'theirs' as "sides" of a rebase, use single quotes. Use back-ticks only for the ours strategy.
* A bulleted list is converted to use ";;" syntax.
Thanks, -Stolee
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1270%2Fderrickstolee%2Frebase-docs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1270/derrickstolee/rebase-docs-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1270
Range-diff vs v2:
1: 02983cdb79d ! 1: 9c59d120c14 git-rebase.txt: use back-ticks consistently
@@ Commit message
was no punctuation. Others are replacing single quotes.
There are also a few minor cleanups in the process, including those
- found by reviwers.
+ found by reviewers.
@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
-replaced by the patch differ only in whitespace from the existing -file, you will get a merge conflict instead of a successful patch -application.
-+apply backend:;;
++apply backend;;
+ When applying a patch, ignore changes in whitespace in context
+ lines. Unfortunately, this means that if the "old" lines being
+ replaced by the patch differ only in whitespace from the existing
@@ Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
-when merging. Unfortunately, this means that any patch hunks that were -intended to modify whitespace and nothing else will be dropped, even -if the other side had no changes that conflicted.
-+merge backend:;;
++merge backend;;
+ Treat lines with only whitespace changes as unchanged when merging.
+ Unfortunately, this means that any patch hunks that were intended
+ to modify whitespace and nothing else will be dropped, even if the
@@ Documentation/git-rebase.txt: In addition, the following pairs of options are in
-----------------------
-git rebase has two primary backends: apply and merge. (The apply
--backend used to be known as the 'am' backend, but the name led to --confusion as it looks like a verb instead of a noun. Also, the merge
+git rebase has two primary backends: 'apply' and 'merge'. (The 'apply'
-+backend used to be known as the am backend, but the name led to
+ backend used to be known as the 'am' backend, but the name led to +-confusion as it looks like a verb instead of a noun. Also, the merge +confusion as it looks like a verb instead of a noun. Also, the 'merge' backend used to be known as the interactive backend, but it is now used for non-interactive cases as well. Both were renamed based on
Documentation/git-rebase.txt | 242 ++++++++++++++++++----------------- 1 file changed, 122 insertions(+), 120 deletions(-)
Documentation/git-rebase.txt +122 -120
@@ -16,40 +16,40 @@ SYNOPSIS DESCRIPTION ----------- -If <branch> is specified, 'git rebase' will perform an automatic +If `<branch>` is specified, `git rebase` will perform an automatic `git switch <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 +If `<upstream>` is not specified, the upstream configured in +`branch.<name>.remote` and `branch.<name>.merge` options will be used (see linkgit: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 +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 +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 +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. +original `<branch>` and remove the `.git/rebase-apply` working files, use +the command `git rebase --abort` instead. Assume the following history exists and the current branch is "topic":
@@ -79,7 +79,7 @@ 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 -will be skipped and warnings will be issued (if the `merge` backend is +will be skipped and warnings will be issued (if the 'merge' backend is used). For example, running `git rebase master` on the following history (in which `A'` and `A` introduce the same set of changes, but have different committer information):
@@ -176,11 +176,11 @@ would result in the removal of commits F and G: ------------ 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 <upstream> +part of topicA. Note that the argument to `--onto` and the `<upstream>` 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
@@ -205,8 +205,8 @@ OPTIONS ------- --onto <newbase>:: 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 + `--onto` option is not specified, the starting point is + `<upstream>`. 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
@@ -215,19 +215,19 @@ leave out at most one of A and B, in which case it defaults to HEAD. --keep-base:: Set the starting point at which to create the new commits to the - merge base of <upstream> and <branch>. Running - 'git rebase --keep-base <upstream> <branch>' is equivalent to + merge base of `<upstream>` and `<branch>`. Running + `git rebase --keep-base <upstream> <branch>` is equivalent to running - 'git rebase --onto <upstream>...<branch> <upstream> <branch>'. + `git rebase --onto <upstream>...<branch> <upstream> <branch>`. + This option is useful in the case where one is developing a feature on top of an upstream branch. While the feature is being worked on, the upstream branch may advance and it may not be the best idea to keep rebasing on top of the upstream but to keep the base commit as-is. + -Although both this option and --fork-point find the merge base between -<upstream> and <branch>, this option uses the merge base as the _starting -point_ on which new commits will be created, whereas --fork-point uses +Although both this option and `--fork-point` find the merge base between +`<upstream>` and `<branch>`, this option uses the merge base as the _starting +point_ on which new commits will be created, whereas `--fork-point` uses the merge base to determine the _set of commits_ which will be rebased. + See also INCOMPATIBLE OPTIONS below.
@@ -238,23 +238,23 @@ See also INCOMPATIBLE OPTIONS below. upstream for the current branch. <branch>:: - Working branch; defaults to HEAD. + Working branch; defaults to `HEAD`. --continue:: Restart the rebasing process after having resolved a merge conflict. --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 + 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. --quit:: - Abort the rebase operation but HEAD is not reset back to the + 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. If a temporary stash entry was created - using --autostash, it will be saved to the stash list. + using `--autostash`, it will be saved to the stash list. --apply:: Use applying strategies to rebase (calling `git-am`
@@ -269,16 +269,16 @@ See also INCOMPATIBLE OPTIONS below. empty after rebasing (because they contain a subset of already upstream changes). With drop (the default), commits that become empty are dropped. With keep, such commits are kept. - With ask (implied by --interactive), the rebase will halt when + With ask (implied by `--interactive`), the rebase will halt when an empty commit is applied allowing you to choose whether to drop it, edit files more, or just commit the empty changes. - Other options, like --exec, will use the default of drop unless - -i/--interactive is explicitly specified. + Other options, like `--exec`, will use the default of drop unless + `-i`/`--interactive` is explicitly specified. + -Note that commits which start empty are kept (unless --no-keep-empty +Note that commits which start empty are kept (unless `--no-keep-empty` is specified), and commits which are clean cherry-picks (as determined by `git log --cherry-mark ...`) are detected and dropped as a -preliminary step (unless --reapply-cherry-picks is passed). +preliminary step (unless `--reapply-cherry-picks` is passed). + See also INCOMPATIBLE OPTIONS below.
@@ -287,7 +287,7 @@ See also INCOMPATIBLE OPTIONS below. Do not keep commits that start empty before the rebase (i.e. that do not change anything from its parent) in the result. The default is to keep commits which start empty, - since creating such commits requires passing the --allow-empty + since creating such commits requires passing the `--allow-empty` override flag to `git commit`, signifying that a user is very intentionally creating such a commit and thus wants to keep it.
@@ -299,7 +299,7 @@ flag exists as a convenient shortcut, such as for cases where external tools generate many empty commits and you want them all removed. + For commits which do not start empty but become empty after rebasing, -see the --empty flag. +see the `--empty` flag. + See also INCOMPATIBLE OPTIONS below.
@@ -314,7 +314,7 @@ See also INCOMPATIBLE OPTIONS below. By default (or if `--no-reapply-cherry-picks` is given), these commits will be automatically dropped. Because this necessitates reading all upstream commits, this can be expensive in repos with a large number -of upstream commits that need to be read. When using the `merge` +of upstream commits that need to be read. When using the 'merge' backend, warnings will be issued for each dropped commit (unless `--quiet` is given). Advice will also be issued unless `advice.skippedCherryPicks` is set to false (see linkgit:git-config[1]).
@@ -348,10 +348,10 @@ See also INCOMPATIBLE OPTIONS below. Using merging strategies to rebase (default). + Note that a rebase merge works by replaying each commit from the working -branch on top of the <upstream> branch. Because of this, when a merge +branch on top of the `<upstream>` branch. Because of this, when a merge conflict happens, the side reported as 'ours' is the so-far rebased -series, starting with <upstream>, and 'theirs' is the working branch. In -other words, the sides are swapped. +series, starting with `<upstream>`, and 'theirs' is the working branch. +In other words, the sides are swapped. + See also INCOMPATIBLE OPTIONS below.
@@ -360,9 +360,9 @@ See also INCOMPATIBLE OPTIONS below. Use the given merge strategy, instead of the default `ort`. This implies `--merge`. + -Because 'git rebase' replays each commit from the working branch -on top of the <upstream> branch using the given strategy, using -the 'ours' strategy simply empties all patches from the <branch>, +Because `git rebase` replays each commit from the working branch +on top of the `<upstream>` branch using the given strategy, using +the `ours` strategy simply empties all patches from the `<branch>`, which makes little sense. + See also INCOMPATIBLE OPTIONS below.
@@ -392,11 +392,11 @@ See also INCOMPATIBLE OPTIONS below. -q:: --quiet:: - Be quiet. Implies --no-stat. + Be quiet. Implies `--no-stat`. -v:: --verbose:: - Be verbose. Implies --stat. + Be verbose. Implies `--stat`. --stat:: Show a diffstat of what changed upstream since the last rebase. The
@@ -411,13 +411,13 @@ See also INCOMPATIBLE OPTIONS below. --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]. + be used to override `--no-verify`. See also linkgit:githooks[5]. -C<n>:: - Ensure at least <n> lines of surrounding context match before + 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. Implies --apply. + ever ignored. Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.
@@ -436,21 +436,21 @@ details). --fork-point:: --no-fork-point:: - Use reflog to find a better common ancestor between <upstream> - and <branch> when calculating which commits have been - introduced by <branch>. + Use reflog to find a better common ancestor between `<upstream>` + and `<branch>` when calculating which commits have been + introduced by `<branch>`. + -When --fork-point is active, 'fork_point' will be used instead of -<upstream> to calculate the set of commits to rebase, where +When `--fork-point` is active, 'fork_point' will be used instead of +`<upstream>` to calculate the set of commits to rebase, where 'fork_point' is the result of `git merge-base --fork-point <upstream> <branch>` command (see linkgit:git-merge-base[1]). If 'fork_point' -ends up being empty, the <upstream> will be used as a fallback. +ends up being empty, the `<upstream>` will be used as a fallback. + -If <upstream> is given on the command line, then the default is +If `<upstream>` is given on the command line, then the default is `--no-fork-point`, otherwise the default is `--fork-point`. See also `rebase.forkpoint` in linkgit:git-config[1]. + -If your branch was based on <upstream> but <upstream> was rewound and +If your branch was based on `<upstream>` but `<upstream>` was rewound and your branch contains commits which were dropped, this option can be used with `--keep-base` in order to drop those commits from your branch. +
@@ -458,24 +458,26 @@ See also INCOMPATIBLE OPTIONS below. --ignore-whitespace:: Ignore whitespace differences when trying to reconcile -differences. Currently, each backend implements an approximation of -this behavior: + differences. Currently, each backend implements an approximation of + this behavior: + -apply backend: When applying a patch, ignore changes in whitespace in -context lines. Unfortunately, this means that if the "old" lines being -replaced by the patch differ only in whitespace from the existing -file, you will get a merge conflict instead of a successful patch -application. +apply backend;; + When applying a patch, ignore changes in whitespace in context + lines. Unfortunately, this means that if the "old" lines being + replaced by the patch differ only in whitespace from the existing + file, you will get a merge conflict instead of a successful patch + application. + -merge backend: Treat lines with only whitespace changes as unchanged -when merging. Unfortunately, this means that any patch hunks that were -intended to modify whitespace and nothing else will be dropped, even -if the other side had no changes that conflicted. +merge backend;; + Treat lines with only whitespace changes as unchanged when merging. + Unfortunately, this means that any patch hunks that were intended + to modify whitespace and nothing else will be dropped, even if the + other side had no changes that conflicted. --whitespace=<option>:: - This flag is passed to the 'git apply' program + This flag is passed to the `git apply` program (see linkgit:git-apply[1]) that applies the patch. - Implies --apply. + Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.
@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + final history. `<cmd>` will be interpreted as one or more shell commands. Any command that fails will interrupt the rebase, with exit code 1. +
@@ -550,7 +552,7 @@ or by giving more than one `--exec`: + git rebase -i --exec "cmd1" --exec "cmd2" --exec ... + -If `--autosquash` is used, "exec" lines will not be appended for +If `--autosquash` is used, `exec` lines will not be appended for the intermediate commits, and will only appear at the end of each squash/fixup series. +
@@ -560,11 +562,12 @@ without an explicit `--interactive`. See also INCOMPATIBLE OPTIONS below. --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. + 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. + See also INCOMPATIBLE OPTIONS below.
@@ -643,9 +646,9 @@ In addition, the following pairs of options are incompatible: BEHAVIORAL DIFFERENCES ----------------------- -git rebase has two primary backends: apply and merge. (The apply +`git rebase` has two primary backends: 'apply' and 'merge'. (The 'apply' backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +confusion as it looks like a verb instead of a noun. Also, the 'merge' backend used to be known as the interactive backend, but it is now used for non-interactive cases as well. Both were renamed based on lower-level functionality that underpinned each.) There are some
@@ -654,19 +657,19 @@ subtle differences in how these two backends behave: Empty commits ~~~~~~~~~~~~~ -The apply backend unfortunately drops intentionally empty commits, i.e. +The 'apply' backend unfortunately drops intentionally empty commits, i.e. commits that started empty, though these are rare in practice. It also drops commits that become empty and has no option for controlling this behavior. -The merge backend keeps intentionally empty commits by default (though -with -i they are marked as empty in the todo list editor, or they can -be dropped automatically with --no-keep-empty). +The 'merge' backend keeps intentionally empty commits by default (though +with `-i` they are marked as empty in the todo list editor, or they can +be dropped automatically with `--no-keep-empty`). Similar to the apply backend, by default the merge backend drops -commits that become empty unless -i/--interactive is specified (in +commits that become empty unless `-i`/`--interactive` is specified (in which case it stops and asks the user what to do). The merge backend -also has an --empty={drop,keep,ask} option for changing the behavior +also has an `--empty={drop,keep,ask}` option for changing the behavior of handling commits that become empty. Directory rename detection
@@ -674,20 +677,20 @@ Directory rename detection Due to the lack of accurate tree information (arising from constructing fake ancestors with the limited information available in -patches), directory rename detection is disabled in the apply backend. +patches), directory rename detection is disabled in the 'apply' backend. Disabled directory rename detection means that if one side of history renames a directory and the other adds new files to the old directory, then the new files will be left behind in the old directory without any warning at the time of rebasing that you may want to move these files into the new directory. -Directory rename detection works with the merge backend to provide you +Directory rename detection works with the 'merge' backend to provide you warnings in such cases. Context ~~~~~~~ -The apply backend works by creating a sequence of patches (by calling +The 'apply' backend works by creating a sequence of patches (by calling `format-patch` internally), and then applying the patches in sequence (calling `am` internally). Patches are composed of multiple hunks, each with line numbers, a context region, and the actual changes. The
@@ -698,11 +701,11 @@ order to apply the changes to the right lines. However, if multiple areas of the code have the same surrounding lines of context, the wrong one can be picked. There are real-world cases where this has caused commits to be reapplied incorrectly with no conflicts reported. -Setting diff.context to a larger value may prevent such types of +Setting `diff.context` to a larger value may prevent such types of problems, but increases the chance of spurious conflicts (since it will require more lines of matching context to apply). -The merge backend works with a full copy of each relevant file, +The 'merge' backend works with a full copy of each relevant file, insulating it from these types of problems. Labelling of conflicts markers
@@ -710,30 +713,30 @@ Labelling of conflicts markers When there are content conflicts, the merge machinery tries to annotate each side's conflict markers with the commits where the -content came from. Since the apply backend drops the original +content came from. Since the 'apply' backend drops the original information about the rebased commits and their parents (and instead generates new fake commits based off limited information in the generated patches), those commits cannot be identified; instead it has -to fall back to a commit summary. Also, when merge.conflictStyle is -set to diff3 or zdiff3, the apply backend will use "constructed merge +to fall back to a commit summary. Also, when `merge.conflictStyle` is +set to `diff3` or `zdiff3`, the 'apply' backend will use "constructed merge base" to label the content from the merge base, and thus provide no information about the merge base commit whatsoever. -The merge backend works with the full commits on both sides of history +The 'merge' backend works with the full commits on both sides of history and thus has no such limitations. Hooks ~~~~~ -The apply backend has not traditionally called the post-commit hook, -while the merge backend has. Both have called the post-checkout hook, -though the merge backend has squelched its output. Further, both +The 'apply' backend has not traditionally called the post-commit hook, +while the 'merge' backend has. Both have called the post-checkout hook, +though the 'merge' backend has squelched its output. Further, both backends only call the post-checkout hook with the starting point commit of the rebase, not the intermediate commits nor the final commit. In each case, the calling of these hooks was by accident of implementation rather than by design (both backends were originally implemented as shell scripts and happened to invoke other commands -like 'git checkout' or 'git commit' that would call the hooks). Both +like `git checkout` or `git commit` that would call the hooks). Both backends should have the same behavior, though it is not entirely clear which, if any, is correct. We will likely make rebase stop calling either of these hooks in the future.
@@ -741,10 +744,10 @@ calling either of these hooks in the future. Interruptability ~~~~~~~~~~~~~~~~ -The apply backend has safety problems with an ill-timed interrupt; if +The 'apply' backend has safety problems with an ill-timed interrupt; if the user presses Ctrl-C at the wrong time to try to abort the rebase, the rebase can enter a state where it cannot be aborted with a -subsequent `git rebase --abort`. The merge backend does not appear to +subsequent `git rebase --abort`. The 'merge' backend does not appear to suffer from the same shortcoming. (See https://lore.kernel.org/git/[email protected]/ for details.)
@@ -756,8 +759,8 @@ When a conflict occurs while rebasing, rebase stops and asks the user to resolve. Since the user may need to make notable changes while resolving conflicts, after conflicts are resolved and the user has run `git rebase --continue`, the rebase should open an editor and ask the -user to update the commit message. The merge backend does this, while -the apply backend blindly applies the original commit message. +user to update the commit message. The 'merge' backend does this, while +the 'apply' backend blindly applies the original commit message. Miscellaneous differences ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -777,23 +780,23 @@ completeness: them to stderr. * State directories: The two backends keep their state in different - directories under .git/ + directories under `.git/` include::merge-strategies.txt[] NOTES ----- -You should understand the implications of using 'git rebase' on a +You should understand the implications of using `git rebase` on a repository that you share. See also RECOVERING FROM UPSTREAM REBASE below. -When the git-rebase command is run, it will first execute a "pre-rebase" -hook if one exists. You can use this hook to do sanity checks and -reject the rebase if it isn't appropriate. Please see the template -pre-rebase hook script for an example. +When the rebase is run, it will first execute a `pre-rebase` hook if one +exists. You can use this hook to do sanity checks and reject the rebase +if it isn't appropriate. Please see the template `pre-rebase` hook script +for an example. -Upon completion, <branch> will be the current branch. +Upon completion, `<branch>` will be the current branch. INTERACTIVE MODE ----------------
@@ -848,7 +851,7 @@ not look at them but at the commit names ("deadbee" and "fa1afe1" in this example), so do not delete or edit the names. By replacing the command "pick" with the command "edit", you can tell -'git rebase' to stop after applying that commit, so that you can edit +`git rebase` to stop after applying that commit, so that you can edit the files and/or the commit message, amend the commit, and continue rebasing.
@@ -876,14 +879,13 @@ commit, the message from the final one is used. You can also use "fixup -C" to get the same behavior as "fixup -c" except without opening an editor. - -'git rebase' will stop when "pick" has been replaced with "edit" or +`git rebase` will stop when "pick" has been replaced with "edit" or when a command fails due to merge errors. When you are done editing and/or resolving conflicts you can continue with `git rebase --continue`. For example, if you want to reorder the last 5 commits, such that what -was HEAD~4 becomes the new HEAD. To achieve that, you would call -'git rebase' like this: +was `HEAD~4` becomes the new `HEAD`. To achieve that, you would call +`git rebase` like this: ---------------------- $ git rebase -i HEAD~5
@@ -903,7 +905,7 @@ like this: ------------------ Suppose you want to rebase the side branch starting at "A" to "Q". Make -sure that the current HEAD is "B", and call +sure that the current `HEAD` is "B", and call ----------------------------- $ git rebase -i -r --onto Q O
@@ -956,23 +958,23 @@ SPLITTING COMMITS ----------------- In interactive mode, you can mark commits with the action "edit". However, -this does not necessarily mean that 'git rebase' expects the result of this +this does not necessarily mean that `git rebase` expects the result of this edit to be exactly one commit. Indeed, you can undo the commit, or you can add other commits. This can be used to split a commit into two: - Start an interactive rebase with `git rebase -i <commit>^`, where - <commit> is the commit you want to split. In fact, any commit range + `<commit>` is the commit you want to split. In fact, any commit range will do, as long as it contains that commit. - Mark the commit you want to split with the action "edit". - When it comes to editing that commit, execute `git reset HEAD^`. The - effect is that the HEAD is rewound by one, and the index follows suit. + effect is that the `HEAD` is rewound by one, and the index follows suit. However, the working tree stays the same. - Now add the changes to the index that you want to have in the first commit. You can use `git add` (possibly interactively) or - 'git gui' (or both) to do that. + `git gui` (or both) to do that. - Commit the now-current index with whatever commit message is appropriate now.
@@ -983,7 +985,7 @@ add other commits. This can be used to split a commit into two: If you are not absolutely sure that the intermediate revisions are consistent (they compile, pass the testsuite, etc.) you should use -'git stash' to stash away the not-yet-committed changes +`git stash` to stash away the not-yet-committed changes after each commit, test, and amend the commit if fixes are necessary.
@@ -1087,12 +1089,12 @@ NOTE: While an "easy case recovery" sometimes appears to be successful example, a commit that was removed via `git rebase --interactive` will be **resurrected**! -The idea is to manually tell 'git rebase' "where the old 'subsystem' +The idea is to manually tell `git rebase` "where the old 'subsystem' ended and your 'topic' began", that is, what the old merge base between them was. You will have to find a way to name the last commit of the old 'subsystem', for example: -* With the 'subsystem' reflog: after 'git fetch', the old tip of +* With the 'subsystem' reflog: after `git fetch`, the old tip of 'subsystem' is at `subsystem@{1}`. Subsequent fetches will increase the number. (See linkgit:git-reflog[1].)
base-commit: 9bef0b1e6ec371e786c2fba3edcc06ad040a536c
Signature · 1 line
gitgitgadget
Hi Stolee
The range-diff looks fine to me
Thanks
Phillip
Quoted 731 lines · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
While inspecting the 'git rebase' documentation, I noticed that it is inconsistent with how it uses back-ticks (or other punctuation) for identifying Git commands, command-line arguments, or values for those arguments.
Sometimes, an argument (like '--interactive') would appear without any punctuation, causing the argument to not have any special formatting. Other times, arguments or 'git rebase' itself would have single-quotes giving a bold look (in the HTML documentation at least).
By consistently using back-ticks, these types of strings appear in a monospace font with special highlighting to appear more clearly as text that exists in a command-line invocation of a Git command.
This rather-large diff is the result of scanning git-rebase.txt and adding back-ticks as appropriate. Some are adding back-ticks where there was no punctuation. Others are replacing single quotes.
There are also a few minor cleanups in the process, including those found by reviewers.
Helped-by Phillip Wood <[email protected]>Helped-by Junio C Hamano <[email protected]>Signed-off-by Derrick Stolee <[email protected]>---
git-rebase.txt: use back-ticks consistentlyWhile I noticed this inconsistency when looking at git rebase as part of the git rebase --update-refs work, I didn't know the best way to update the document from start to finish.
Feedback tells me that splitting this patch isn't worth it.
Updates in v3
=============* A much smaller round of edits, but huge thanks to Junio and Phillip for a careful attention to detail.
* Use 'am' over am.
* Don't use colons in subsection headings.
* Fix a commit message typo.Updates in v2
=============* The 'apply' and 'merge' backends are now quoted with single quotes instead of back-ticks. (Phrases such as "the merge command" describing the todo file still use back-ticks.)
* The pre-rebase hook now has back-ticks.
* An unnecessary comma is removed.
* When talking about 'ours' and 'theirs' as "sides" of a rebase, use single quotes. Use back-ticks only for the ours strategy.
* A bulleted list is converted to use ";;" syntax.Thanks, -Stolee
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1270%2Fderrickstolee%2Frebase-docs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1270/derrickstolee/rebase-docs-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1270Range-diff vs v2:
1:
02983cdb79d! 1:9c59d120c14git-rebase.txt: use back-ticks consistently
@@ Commit message
was no punctuation. Others are replacing single quotes.There are also a few minor cleanups in the process, including those
- found by reviwers.
+ found by reviewers.Helped-by Phillip Wood <[email protected]>Helped-by Junio C Hamano <[email protected]>@@
Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
-replaced by the patch differ only in whitespace from the existing -file, you will get a merge conflict instead of a successful patch -application.
-+apply backend:;;
++apply backend;;
+ When applying a patch, ignore changes in whitespace in context
+ lines. Unfortunately, this means that if the "old" lines being
+ replaced by the patch differ only in whitespace from the existing
@@Documentation/git-rebase.txt: See also INCOMPATIBLE OPTIONS below.
-when merging. Unfortunately, this means that any patch hunks that were -intended to modify whitespace and nothing else will be dropped, even -if the other side had no changes that conflicted.
-+merge backend:;;
++merge backend;;
+ Treat lines with only whitespace changes as unchanged when merging.
+ Unfortunately, this means that any patch hunks that were intended
+ to modify whitespace and nothing else will be dropped, even if the
@@Documentation/git-rebase.txt: In addition, the following pairs of options are in
------------------------git rebase has two primary backends: apply and merge. (The apply
--backend used to be known as the 'am' backend, but the name led to --confusion as it looks like a verb instead of a noun. Also, the merge
+git rebasehas two primary backends: 'apply' and 'merge'. (The 'apply'
-+backend used to be known as theambackend, but the name led to
+ backend used to be known as the 'am' backend, but the name led to +-confusion as it looks like a verb instead of a noun. Also, the merge +confusion as it looks like a verb instead of a noun. Also, the 'merge' backend used to be known as the interactive backend, but it is now used for non-interactive cases as well. Both were renamed based onDocumentation/git-rebase.txt | 242 ++++++++++++++++++----------------- 1 file changed, 122 insertions(+), 120 deletions(-)Documentation/git-rebase.txt +122
-120@@ -16,40 +16,40 @@ SYNOPSIS DESCRIPTION ----------- -If <branch> is specified, 'git rebase' will perform an automatic +If `<branch>` is specified, `git rebase` will perform an automatic `git switch <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 +If `<upstream>` is not specified, the upstream configured in +`branch.<name>.remote` and `branch.<name>.merge` options will be used (see linkgit: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 +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 +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 +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. +original `<branch>` and remove the `.git/rebase-apply` working files, use +the command `git rebase --abort` instead. Assume the following history exists and the current branch is "topic":@@ -79,7 +79,7 @@ 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 -will be skipped and warnings will be issued (if the `merge` backend is +will be skipped and warnings will be issued (if the 'merge' backend is used). For example, running `git rebase master` on the following history (in which `A'` and `A` introduce the same set of changes, but have different committer information):@@ -176,11 +176,11 @@ would result in the removal of commits F and G: ------------ 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 <upstream> +part of topicA. Note that the argument to `--onto` and the `<upstream>` 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@@ -205,8 +205,8 @@ OPTIONS ------- --onto <newbase>:: 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 + `--onto` option is not specified, the starting point is + `<upstream>`. 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@@ -215,19 +215,19 @@ leave out at most one of A and B, in which case it defaults to HEAD. --keep-base:: Set the starting point at which to create the new commits to the - merge base of <upstream> and <branch>. Running - 'git rebase --keep-base <upstream> <branch>' is equivalent to + merge base of `<upstream>` and `<branch>`. Running + `git rebase --keep-base <upstream> <branch>` is equivalent to running - 'git rebase --onto <upstream>...<branch> <upstream> <branch>'. + `git rebase --onto <upstream>...<branch> <upstream> <branch>`. + This option is useful in the case where one is developing a feature on top of an upstream branch. While the feature is being worked on, the upstream branch may advance and it may not be the best idea to keep rebasing on top of the upstream but to keep the base commit as-is. + -Although both this option and --fork-point find the merge base between -<upstream> and <branch>, this option uses the merge base as the _starting -point_ on which new commits will be created, whereas --fork-point uses +Although both this option and `--fork-point` find the merge base between +`<upstream>` and `<branch>`, this option uses the merge base as the _starting +point_ on which new commits will be created, whereas `--fork-point` uses the merge base to determine the _set of commits_ which will be rebased. + See also INCOMPATIBLE OPTIONS below.@@ -238,23 +238,23 @@ See also INCOMPATIBLE OPTIONS below. upstream for the current branch. <branch>:: - Working branch; defaults to HEAD. + Working branch; defaults to `HEAD`. --continue:: Restart the rebasing process after having resolved a merge conflict. --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 + 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. --quit:: - Abort the rebase operation but HEAD is not reset back to the + 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. If a temporary stash entry was created - using --autostash, it will be saved to the stash list. + using `--autostash`, it will be saved to the stash list. --apply:: Use applying strategies to rebase (calling `git-am`@@ -269,16 +269,16 @@ See also INCOMPATIBLE OPTIONS below. empty after rebasing (because they contain a subset of already upstream changes). With drop (the default), commits that become empty are dropped. With keep, such commits are kept. - With ask (implied by --interactive), the rebase will halt when + With ask (implied by `--interactive`), the rebase will halt when an empty commit is applied allowing you to choose whether to drop it, edit files more, or just commit the empty changes. - Other options, like --exec, will use the default of drop unless - -i/--interactive is explicitly specified. + Other options, like `--exec`, will use the default of drop unless + `-i`/`--interactive` is explicitly specified. + -Note that commits which start empty are kept (unless --no-keep-empty +Note that commits which start empty are kept (unless `--no-keep-empty` is specified), and commits which are clean cherry-picks (as determined by `git log --cherry-mark ...`) are detected and dropped as a -preliminary step (unless --reapply-cherry-picks is passed). +preliminary step (unless `--reapply-cherry-picks` is passed). + See also INCOMPATIBLE OPTIONS below.@@ -287,7 +287,7 @@ See also INCOMPATIBLE OPTIONS below. Do not keep commits that start empty before the rebase (i.e. that do not change anything from its parent) in the result. The default is to keep commits which start empty, - since creating such commits requires passing the --allow-empty + since creating such commits requires passing the `--allow-empty` override flag to `git commit`, signifying that a user is very intentionally creating such a commit and thus wants to keep it.@@ -299,7 +299,7 @@ flag exists as a convenient shortcut, such as for cases where external tools generate many empty commits and you want them all removed. + For commits which do not start empty but become empty after rebasing, -see the --empty flag. +see the `--empty` flag. + See also INCOMPATIBLE OPTIONS below.@@ -314,7 +314,7 @@ See also INCOMPATIBLE OPTIONS below. By default (or if `--no-reapply-cherry-picks` is given), these commits will be automatically dropped. Because this necessitates reading all upstream commits, this can be expensive in repos with a large number -of upstream commits that need to be read. When using the `merge` +of upstream commits that need to be read. When using the 'merge' backend, warnings will be issued for each dropped commit (unless `--quiet` is given). Advice will also be issued unless `advice.skippedCherryPicks` is set to false (see linkgit:git-config[1]).@@ -348,10 +348,10 @@ See also INCOMPATIBLE OPTIONS below. Using merging strategies to rebase (default). + Note that a rebase merge works by replaying each commit from the working -branch on top of the <upstream> branch. Because of this, when a merge +branch on top of the `<upstream>` branch. Because of this, when a merge conflict happens, the side reported as 'ours' is the so-far rebased -series, starting with <upstream>, and 'theirs' is the working branch. In -other words, the sides are swapped. +series, starting with `<upstream>`, and 'theirs' is the working branch. +In other words, the sides are swapped. + See also INCOMPATIBLE OPTIONS below.@@ -360,9 +360,9 @@ See also INCOMPATIBLE OPTIONS below. Use the given merge strategy, instead of the default `ort`. This implies `--merge`. + -Because 'git rebase' replays each commit from the working branch -on top of the <upstream> branch using the given strategy, using -the 'ours' strategy simply empties all patches from the <branch>, +Because `git rebase` replays each commit from the working branch +on top of the `<upstream>` branch using the given strategy, using +the `ours` strategy simply empties all patches from the `<branch>`, which makes little sense. + See also INCOMPATIBLE OPTIONS below.@@ -392,11 +392,11 @@ See also INCOMPATIBLE OPTIONS below. -q:: --quiet:: - Be quiet. Implies --no-stat. + Be quiet. Implies `--no-stat`. -v:: --verbose:: - Be verbose. Implies --stat. + Be verbose. Implies `--stat`. --stat:: Show a diffstat of what changed upstream since the last rebase. The@@ -411,13 +411,13 @@ See also INCOMPATIBLE OPTIONS below. --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]. + be used to override `--no-verify`. See also linkgit:githooks[5]. -C<n>:: - Ensure at least <n> lines of surrounding context match before + 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. Implies --apply. + ever ignored. Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.@@ -436,21 +436,21 @@ details). --fork-point:: --no-fork-point:: - Use reflog to find a better common ancestor between <upstream> - and <branch> when calculating which commits have been - introduced by <branch>. + Use reflog to find a better common ancestor between `<upstream>` + and `<branch>` when calculating which commits have been + introduced by `<branch>`. + -When --fork-point is active, 'fork_point' will be used instead of -<upstream> to calculate the set of commits to rebase, where +When `--fork-point` is active, 'fork_point' will be used instead of +`<upstream>` to calculate the set of commits to rebase, where 'fork_point' is the result of `git merge-base --fork-point <upstream> <branch>` command (see linkgit:git-merge-base[1]). If 'fork_point' -ends up being empty, the <upstream> will be used as a fallback. +ends up being empty, the `<upstream>` will be used as a fallback. + -If <upstream> is given on the command line, then the default is +If `<upstream>` is given on the command line, then the default is `--no-fork-point`, otherwise the default is `--fork-point`. See also `rebase.forkpoint` in linkgit:git-config[1]. + -If your branch was based on <upstream> but <upstream> was rewound and +If your branch was based on `<upstream>` but `<upstream>` was rewound and your branch contains commits which were dropped, this option can be used with `--keep-base` in order to drop those commits from your branch. +@@ -458,24 +458,26 @@ See also INCOMPATIBLE OPTIONS below. --ignore-whitespace:: Ignore whitespace differences when trying to reconcile -differences. Currently, each backend implements an approximation of -this behavior: + differences. Currently, each backend implements an approximation of + this behavior: + -apply backend: When applying a patch, ignore changes in whitespace in -context lines. Unfortunately, this means that if the "old" lines being -replaced by the patch differ only in whitespace from the existing -file, you will get a merge conflict instead of a successful patch -application. +apply backend;; + When applying a patch, ignore changes in whitespace in context + lines. Unfortunately, this means that if the "old" lines being + replaced by the patch differ only in whitespace from the existing + file, you will get a merge conflict instead of a successful patch + application. + -merge backend: Treat lines with only whitespace changes as unchanged -when merging. Unfortunately, this means that any patch hunks that were -intended to modify whitespace and nothing else will be dropped, even -if the other side had no changes that conflicted. +merge backend;; + Treat lines with only whitespace changes as unchanged when merging. + Unfortunately, this means that any patch hunks that were intended + to modify whitespace and nothing else will be dropped, even if the + other side had no changes that conflicted. --whitespace=<option>:: - This flag is passed to the 'git apply' program + This flag is passed to the `git apply` program (see linkgit:git-apply[1]) that applies the patch. - Implies --apply. + Implies `--apply`. + See also INCOMPATIBLE OPTIONS below.@@ -537,7 +539,7 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below. -x <cmd>:: --exec <cmd>:: Append "exec <cmd>" after each line creating a commit in the - final history. <cmd> will be interpreted as one or more shell + final history. `<cmd>` will be interpreted as one or more shell commands. Any command that fails will interrupt the rebase, with exit code 1. +@@ -550,7 +552,7 @@ or by giving more than one `--exec`: + git rebase -i --exec "cmd1" --exec "cmd2" --exec ... + -If `--autosquash` is used, "exec" lines will not be appended for +If `--autosquash` is used, `exec` lines will not be appended for the intermediate commits, and will only appear at the end of each squash/fixup series. +@@ -560,11 +562,12 @@ without an explicit `--interactive`. See also INCOMPATIBLE OPTIONS below. --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. + 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. + See also INCOMPATIBLE OPTIONS below.@@ -643,9 +646,9 @@ In addition, the following pairs of options are incompatible: BEHAVIORAL DIFFERENCES ----------------------- -git rebase has two primary backends: apply and merge. (The apply +`git rebase` has two primary backends: 'apply' and 'merge'. (The 'apply' backend used to be known as the 'am' backend, but the name led to -confusion as it looks like a verb instead of a noun. Also, the merge +confusion as it looks like a verb instead of a noun. Also, the 'merge' backend used to be known as the interactive backend, but it is now used for non-interactive cases as well. Both were renamed based on lower-level functionality that underpinned each.) There are some@@ -654,19 +657,19 @@ subtle differences in how these two backends behave: Empty commits ~~~~~~~~~~~~~ -The apply backend unfortunately drops intentionally empty commits, i.e. +The 'apply' backend unfortunately drops intentionally empty commits, i.e. commits that started empty, though these are rare in practice. It also drops commits that become empty and has no option for controlling this behavior. -The merge backend keeps intentionally empty commits by default (though -with -i they are marked as empty in the todo list editor, or they can -be dropped automatically with --no-keep-empty). +The 'merge' backend keeps intentionally empty commits by default (though +with `-i` they are marked as empty in the todo list editor, or they can +be dropped automatically with `--no-keep-empty`). Similar to the apply backend, by default the merge backend drops -commits that become empty unless -i/--interactive is specified (in +commits that become empty unless `-i`/`--interactive` is specified (in which case it stops and asks the user what to do). The merge backend -also has an --empty={drop,keep,ask} option for changing the behavior +also has an `--empty={drop,keep,ask}` option for changing the behavior of handling commits that become empty. Directory rename detection@@ -674,20 +677,20 @@ Directory rename detection Due to the lack of accurate tree information (arising from constructing fake ancestors with the limited information available in -patches), directory rename detection is disabled in the apply backend. +patches), directory rename detection is disabled in the 'apply' backend. Disabled directory rename detection means that if one side of history renames a directory and the other adds new files to the old directory, then the new files will be left behind in the old directory without any warning at the time of rebasing that you may want to move these files into the new directory. -Directory rename detection works with the merge backend to provide you +Directory rename detection works with the 'merge' backend to provide you warnings in such cases. Context ~~~~~~~ -The apply backend works by creating a sequence of patches (by calling +The 'apply' backend works by creating a sequence of patches (by calling `format-patch` internally), and then applying the patches in sequence (calling `am` internally). Patches are composed of multiple hunks, each with line numbers, a context region, and the actual changes. The@@ -698,11 +701,11 @@ order to apply the changes to the right lines. However, if multiple areas of the code have the same surrounding lines of context, the wrong one can be picked. There are real-world cases where this has caused commits to be reapplied incorrectly with no conflicts reported. -Setting diff.context to a larger value may prevent such types of +Setting `diff.context` to a larger value may prevent such types of problems, but increases the chance of spurious conflicts (since it will require more lines of matching context to apply). -The merge backend works with a full copy of each relevant file, +The 'merge' backend works with a full copy of each relevant file, insulating it from these types of problems. Labelling of conflicts markers@@ -710,30 +713,30 @@ Labelling of conflicts markers When there are content conflicts, the merge machinery tries to annotate each side's conflict markers with the commits where the -content came from. Since the apply backend drops the original +content came from. Since the 'apply' backend drops the original information about the rebased commits and their parents (and instead generates new fake commits based off limited information in the generated patches), those commits cannot be identified; instead it has -to fall back to a commit summary. Also, when merge.conflictStyle is -set to diff3 or zdiff3, the apply backend will use "constructed merge +to fall back to a commit summary. Also, when `merge.conflictStyle` is +set to `diff3` or `zdiff3`, the 'apply' backend will use "constructed merge base" to label the content from the merge base, and thus provide no information about the merge base commit whatsoever. -The merge backend works with the full commits on both sides of history +The 'merge' backend works with the full commits on both sides of history and thus has no such limitations. Hooks ~~~~~ -The apply backend has not traditionally called the post-commit hook, -while the merge backend has. Both have called the post-checkout hook, -though the merge backend has squelched its output. Further, both +The 'apply' backend has not traditionally called the post-commit hook, +while the 'merge' backend has. Both have called the post-checkout hook, +though the 'merge' backend has squelched its output. Further, both backends only call the post-checkout hook with the starting point commit of the rebase, not the intermediate commits nor the final commit. In each case, the calling of these hooks was by accident of implementation rather than by design (both backends were originally implemented as shell scripts and happened to invoke other commands -like 'git checkout' or 'git commit' that would call the hooks). Both +like `git checkout` or `git commit` that would call the hooks). Both backends should have the same behavior, though it is not entirely clear which, if any, is correct. We will likely make rebase stop calling either of these hooks in the future.@@ -741,10 +744,10 @@ calling either of these hooks in the future. Interruptability ~~~~~~~~~~~~~~~~ -The apply backend has safety problems with an ill-timed interrupt; if +The 'apply' backend has safety problems with an ill-timed interrupt; if the user presses Ctrl-C at the wrong time to try to abort the rebase, the rebase can enter a state where it cannot be aborted with a -subsequent `git rebase --abort`. The merge backend does not appear to +subsequent `git rebase --abort`. The 'merge' backend does not appear to suffer from the same shortcoming. (See https://lore.kernel.org/git/[email protected]/ for details.)@@ -756,8 +759,8 @@ When a conflict occurs while rebasing, rebase stops and asks the user to resolve. Since the user may need to make notable changes while resolving conflicts, after conflicts are resolved and the user has run `git rebase --continue`, the rebase should open an editor and ask the -user to update the commit message. The merge backend does this, while -the apply backend blindly applies the original commit message. +user to update the commit message. The 'merge' backend does this, while +the 'apply' backend blindly applies the original commit message. Miscellaneous differences ~~~~~~~~~~~~~~~~~~~~~~~~~@@ -777,23 +780,23 @@ completeness: them to stderr. * State directories: The two backends keep their state in different - directories under .git/ + directories under `.git/` include::merge-strategies.txt[] NOTES ----- -You should understand the implications of using 'git rebase' on a +You should understand the implications of using `git rebase` on a repository that you share. See also RECOVERING FROM UPSTREAM REBASE below. -When the git-rebase command is run, it will first execute a "pre-rebase" -hook if one exists. You can use this hook to do sanity checks and -reject the rebase if it isn't appropriate. Please see the template -pre-rebase hook script for an example. +When the rebase is run, it will first execute a `pre-rebase` hook if one +exists. You can use this hook to do sanity checks and reject the rebase +if it isn't appropriate. Please see the template `pre-rebase` hook script +for an example. -Upon completion, <branch> will be the current branch. +Upon completion, `<branch>` will be the current branch. INTERACTIVE MODE ----------------@@ -848,7 +851,7 @@ not look at them but at the commit names ("deadbee" and "fa1afe1" in this example), so do not delete or edit the names. By replacing the command "pick" with the command "edit", you can tell -'git rebase' to stop after applying that commit, so that you can edit +`git rebase` to stop after applying that commit, so that you can edit the files and/or the commit message, amend the commit, and continue rebasing.@@ -876,14 +879,13 @@ commit, the message from the final one is used. You can also use "fixup -C" to get the same behavior as "fixup -c" except without opening an editor. - -'git rebase' will stop when "pick" has been replaced with "edit" or +`git rebase` will stop when "pick" has been replaced with "edit" or when a command fails due to merge errors. When you are done editing and/or resolving conflicts you can continue with `git rebase --continue`. For example, if you want to reorder the last 5 commits, such that what -was HEAD~4 becomes the new HEAD. To achieve that, you would call -'git rebase' like this: +was `HEAD~4` becomes the new `HEAD`. To achieve that, you would call +`git rebase` like this: ---------------------- $ git rebase -i HEAD~5@@ -903,7 +905,7 @@ like this: ------------------ Suppose you want to rebase the side branch starting at "A" to "Q". Make -sure that the current HEAD is "B", and call +sure that the current `HEAD` is "B", and call ----------------------------- $ git rebase -i -r --onto Q O@@ -956,23 +958,23 @@ SPLITTING COMMITS ----------------- In interactive mode, you can mark commits with the action "edit". However, -this does not necessarily mean that 'git rebase' expects the result of this +this does not necessarily mean that `git rebase` expects the result of this edit to be exactly one commit. Indeed, you can undo the commit, or you can add other commits. This can be used to split a commit into two: - Start an interactive rebase with `git rebase -i <commit>^`, where - <commit> is the commit you want to split. In fact, any commit range + `<commit>` is the commit you want to split. In fact, any commit range will do, as long as it contains that commit. - Mark the commit you want to split with the action "edit". - When it comes to editing that commit, execute `git reset HEAD^`. The - effect is that the HEAD is rewound by one, and the index follows suit. + effect is that the `HEAD` is rewound by one, and the index follows suit. However, the working tree stays the same. - Now add the changes to the index that you want to have in the first commit. You can use `git add` (possibly interactively) or - 'git gui' (or both) to do that. + `git gui` (or both) to do that. - Commit the now-current index with whatever commit message is appropriate now.@@ -983,7 +985,7 @@ add other commits. This can be used to split a commit into two: If you are not absolutely sure that the intermediate revisions are consistent (they compile, pass the testsuite, etc.) you should use -'git stash' to stash away the not-yet-committed changes +`git stash` to stash away the not-yet-committed changes after each commit, test, and amend the commit if fixes are necessary.@@ -1087,12 +1089,12 @@ NOTE: While an "easy case recovery" sometimes appears to be successful example, a commit that was removed via `git rebase --interactive` will be **resurrected**! -The idea is to manually tell 'git rebase' "where the old 'subsystem' +The idea is to manually tell `git rebase` "where the old 'subsystem' ended and your 'topic' began", that is, what the old merge base between them was. You will have to find a way to name the last commit of the old 'subsystem', for example: -* With the 'subsystem' reflog: after 'git fetch', the old tip of +* With the 'subsystem' reflog: after `git fetch`, the old tip of 'subsystem' is at `subsystem@{1}`. Subsequent fetches will increase the number. (See linkgit:git-reflog[1].)base-commit:
9bef0b1e6ec371e786c2fba3edcc06ad040a536c
Quoted 3 lines · Phillip Wood
Hi Stolee
The range-diff looks fine to me
Will queue. Thanks, both.