2015-12-29 22:54:20 +00:00
|
|
|
# git rebase
|
|
|
|
|
2016-01-21 12:08:45 +00:00
|
|
|
> Apply local commits on top of another branch's history.
|
2016-11-09 18:20:40 +00:00
|
|
|
> This effectively "moves" an entire branch to another base, by creating copies of the commits in the new location.
|
2015-12-29 22:54:20 +00:00
|
|
|
|
2016-11-09 18:20:40 +00:00
|
|
|
- Rebase the current branch on top of the master branch:
|
2015-12-29 22:54:20 +00:00
|
|
|
|
2016-11-09 18:20:40 +00:00
|
|
|
`git rebase master`
|
2015-12-30 17:36:58 +00:00
|
|
|
|
2016-11-09 18:20:40 +00:00
|
|
|
- Start an interactive rebase, which allows the commits to be reordered, omitted, combined or modified:
|
2015-12-30 17:36:58 +00:00
|
|
|
|
2016-11-09 18:20:40 +00:00
|
|
|
`git rebase -i {{target_base_branch}}`
|
2015-12-30 17:36:58 +00:00
|
|
|
|
2016-11-09 18:20:40 +00:00
|
|
|
- Continue a rebase that was interrupted by a merge failure, after editing conflicting files:
|
2015-12-30 17:36:58 +00:00
|
|
|
|
|
|
|
`git rebase --continue`
|
|
|
|
|
2016-11-09 18:20:40 +00:00
|
|
|
- Abort a rebase in progress (e.g. if it is interrupted by a merge conflict):
|
2015-12-30 17:36:58 +00:00
|
|
|
|
|
|
|
`git rebase --abort`
|
2016-09-21 07:58:28 +01:00
|
|
|
|
2016-11-09 18:20:40 +00:00
|
|
|
- Rebase a branch starting from a specific base commit, rather than the common ancestor shared with the target branch:
|
2016-09-21 07:58:28 +01:00
|
|
|
|
|
|
|
`git rebase --onto {{new_base_commit}} {{old_base_commit}}`
|