1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 22:22:09 +02:00
tldr/pages/common/git-rebase.md
2017-04-26 13:06:01 +01:00

28 lines
911 B
Markdown

# git rebase
> Reapply commits from one branch on top of another branch.
> Commonly used to "move" an entire branch to another base, creating copies of the commits in the new location.
- Rebase the current branch on top of the master branch:
`git rebase {{master}}`
- Start an interactive rebase, which allows the commits to be reordered, omitted, combined or modified:
`git rebase -i {{target_base_branch}}`
- Continue a rebase that was interrupted by a merge failure, after editing conflicting files:
`git rebase --continue`
- Abort a rebase in progress (e.g. if it is interrupted by a merge conflict):
`git rebase --abort`
- Move part of the current branch onto a new base, providing the old base to start from:
`git rebase --onto {{new_base}} {{old_base}}`
- Reapply the last 5 commits in-place, stopping to allow them to be reordered, omitted, combined or modified:
`git rebase -i {{HEAD~5}}`