tldr/pages/common/git-rebase.md
Starbeamrainbowlabs 948bcac65d
git-*: use inclusive language (#4533)
* git subtree: make language inclusive

* git revert: make language inclusive

* git rev-list: make language inclusive

* git request-pull: make language inclusive

* git rebase: make language inclusive

* git revert/es: make language inclusive

* git rev-list/es: make language inclusive

* git rebase/es: make language inclusive

* git-rebase/es: improve language

Co-authored-by: Marco Bonelli <marco@mebeim.net>

* git-rebase/es: improve language

Co-authored-by: Axel Navarro <navarroaxel@gmail.com>

* Update git-rebase.md

* git-subtree: revise example description

* git-rebase/es: translate branch_name

Co-authored-by: Axel Navarro <navarroaxel@gmail.com>

* Update git-rebase.md

* Update git-rev-list.md

* Update pages.es/common/git-revert.md

Co-authored-by: Axel Navarro <navarroaxel@gmail.com>

* Apply suggestions from code review

Co-authored-by: Waldir Pimenta <waldyrious@gmail.com>

Co-authored-by: Marco Bonelli <marco@mebeim.net>
Co-authored-by: Axel Navarro <navarroaxel@gmail.com>
Co-authored-by: Waldir Pimenta <waldyrious@gmail.com>
2020-10-19 19:26:01 +01:00

1.3 KiB

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. More information: https://git-scm.com/docs/git-rebase.

  • Rebase the current branch on top of another specified branch:

git rebase {{new_base_branch}}

  • Start an interactive rebase, which allows the commits to be reordered, omitted, combined or modified:

git rebase -i {{target_base_branch_or_commit_hash}}

  • Continue a rebase that was interrupted by a merge failure, after editing conflicting files:

git rebase --continue

  • Continue a rebase that was paused due to merge conflicts, by skipping the conflicted commit:

git rebase --skip

  • 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}}

  • Auto-resolve any conflicts by favoring the working branch version (theirs keyword has reversed meaning in this case):

git rebase -X theirs {{branch_name}}