iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 1 | git-rebase-update(1) |
| 2 | ==================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-rebase-update - |
| 7 | include::_git-rebase-update_desc.helper.txt[] |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| 11 | [verse] |
stip@chromium.org | 74374f9 | 2015-09-10 23:47:24 +0000 | [diff] [blame] | 12 | 'git rebase-update' [-v | --verbose] [-n | --no-fetch] [-k | --keep-going] |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| 16 | |
| 17 | Brings all branches up-to-date with their tracking branches. This involves |
| 18 | several phases: |
| 19 | |
| 20 | Preparation:: |
| 21 | If you currently have a branch checked out, any changes on that branch are |
| 22 | 'frozen' (See linkgit:git-freeze[1] for more detail). Additionally, the current |
| 23 | branch is recorded for the 'Restoration' phase later (see 'CONFIGURATION |
| 24 | VARIABLES' for details on `depot-tools.rebase-update.starting-branch`). |
| 25 | |
| 26 | Fetching:: |
| 27 | All branches are examined to find their upstream references. The correct set |
| 28 | of git remotes is determined, and fetched accordingly. Note that if any |
| 29 | branches have a tag as their upstream, we are forced to pull all remotes. |
| 30 | + |
pgervais@chromium.org | b9f2751 | 2014-08-08 15:52:33 +0000 | [diff] [blame] | 31 | Pass `--no-fetch` to skip this phase. |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 32 | |
| 33 | Rebasing:: |
| 34 | All branches are rebased in topological order from roots (upstreams) to |
| 35 | leaves. Each branch is rebased from its marked merge-base (see 'CONFIGURATION |
| 36 | VARIABLES') to the branch tip on top of its parent branch. If the parent |
| 37 | branch is 'frozen' (see linkgit:git-freeze[1]), the branch will be rebased |
| 38 | onto the last non-freeze commit on the parent branch. |
| 39 | + |
| 40 | Things get interesting when there are merge conflicts on rebase. The *most |
| 41 | common* cause for conflicts is when your branch has been committed to the |
| 42 | upstream in squashed form, ala linkgit:git-squash-branch[1], which is what |
| 43 | linkgit:git-cl[1] and the 'Commit Queue' will do. Because of that, `git |
| 44 | rebase-update` will attempt to squash your conflicted branch to see if the |
| 45 | squashed version applies cleanly to its upstream. |
| 46 | + |
| 47 | If it does not apply cleanly, then your original (non-squashed) branch will be |
| 48 | left in mid-rebase and `git rebase-update` will exit. You can deal with this |
| 49 | like any other conflicted rebase. When you're done, just `git rebase-update` |
| 50 | again to pick up where you left off. |
| 51 | |
stip@chromium.org | 74374f9 | 2015-09-10 23:47:24 +0000 | [diff] [blame] | 52 | If you'd like to rebase all rebaseable branches in one pass and manually process |
| 53 | the unrebaseable ones later, use -k or --keep-going. Cleanup will not happen |
| 54 | until all branches apply cleanly. |
| 55 | |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 56 | Cleanup:: |
| 57 | Once all the branches have been rebased, any empty branches (i.e. branches |
| 58 | with no commits on them) are removed. If a branch is removed in this fashion, |
| 59 | any branches which depend on it are reparented to the parent of the removed |
| 60 | branch (see linkgit:git-reparent-branch[1]). |
| 61 | |
| 62 | Restoration:: |
| 63 | `git rebase-update` checks out the branch that you started on, and 'thaws' it, |
| 64 | if necessary (see linkgit:git-thaw[1]). If the branch you started on got |
| 65 | cleaned up, `git rebase-update` will checkout the 'root' ref (defaults to |
| 66 | 'origin/master', as configured by `depot-tools.upstream`, see |
| 67 | linkgit:git-new-branch[1]). |
| 68 | |
| 69 | |
| 70 | OPTIONS |
| 71 | ------- |
| 72 | |
Daniel McArdle | 43c083d | 2019-05-03 18:02:45 +0000 | [diff] [blame] | 73 | -k:: |
| 74 | --keep-going:: |
| 75 | Keep processing past failed rebases. |
| 76 | |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 77 | -n:: |
pgervais@chromium.org | b9f2751 | 2014-08-08 15:52:33 +0000 | [diff] [blame] | 78 | --no-fetch:: |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 79 | Skip the `git fetch` phase of rebase-update. |
| 80 | |
| 81 | -v:: |
| 82 | --verbose:: |
| 83 | More text than your terminal can handle. |
| 84 | |
Daniel McArdle | 43c083d | 2019-05-03 18:02:45 +0000 | [diff] [blame] | 85 | --current:: |
| 86 | Only rebase the current branch. |
| 87 | |
iannucci@chromium.org | c050a5b | 2014-03-26 06:18:50 +0000 | [diff] [blame] | 88 | |
| 89 | CONFIGURATION VARIABLES |
| 90 | ----------------------- |
| 91 | |
| 92 | depot-tools.rebase-update.starting-branch |
| 93 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 94 | |
| 95 | When `git rebase-update` first runs, it will record the current branch here so |
| 96 | that when it completes successfully, it will return back to the same branch you |
| 97 | started on, even if `git rebase-update` is interrupted due to rebase conflicts. |
| 98 | When `git rebase-update` completes successfully, this configuration variable is |
| 99 | removed. |
| 100 | |
| 101 | branch.<name>.dormant |
| 102 | ~~~~~~~~~~~~~~~~~~~~~ |
| 103 | |
| 104 | If `true`, will cause rebase-update to skip all processing on the branch. |
| 105 | Useful for old/high-conflict branches which you want to keep for posterity, but |
| 106 | don't want to deal with when running `git rebase-update` |
| 107 | |
| 108 | branch.<name>.base |
| 109 | ~~~~~~~~~~~~~~~~~~ |
| 110 | |
| 111 | Holds the 'base' reference for this branch. By default this is equivalent to |
| 112 | `git merge-base <name> <name>@{upstream}`. However, it can diverge if |
| 113 | `<name>@{upstream}` is manually rebased. In this case, it correctly preserves |
| 114 | the value it had before, where `git merge-base` would now report the wrong |
| 115 | value. |
| 116 | |
| 117 | All of the tools in the linkgit:depot_tools[1] suite collude to keep this value |
| 118 | as up-to-date as possible, including linkgit:git-reparent-branch[1], and |
| 119 | linkgit:git-new-branch[1]. linkgit:git-map[1] also shows the location of these |
| 120 | marker values in [black-background white]**white**. |
| 121 | |
| 122 | linkgit:git-mark-merge-base[1] allows easy manual interaction for this value, |
| 123 | in the unlikely event that it gets out of sync. |
| 124 | |
| 125 | include::_aliases.txt[] |
| 126 | |
| 127 | ---- |
| 128 | [alias] |
| 129 | git reup = rebase-update |
| 130 | ---- |
| 131 | |
| 132 | |
| 133 | SEE ALSO |
| 134 | -------- |
| 135 | linkgit:git-new-branch[1], linkgit:git-reparent-branch[1], |
| 136 | linkgit:git-rename-branch[1], linkgit:git-upstream-diff[1], |
| 137 | linkgit:git-freeze[1], linkgit:git-mark-merge-base[1] |
| 138 | |
| 139 | include::_footer.txt[] |
| 140 | |
| 141 | // vim: ft=asciidoc: |