git-rebase:tldr:e9841
git-rebase: Move part of the current branch onto a new base, providing the old base to start from.
$ git rebase --onto ${new_base} ${old_base}
try on your machine
The command git rebase --onto ${new_base} ${old_base}
is used to move a branch's commits onto a new base commit.
Here's a breakdown of the command:
git rebase
: It is a Git command used to modify the commit history by moving or combining commits.--onto
: This option specifies the new base commit where you want to move the branch's commits. It is followed by${new_base}
, which represents the commit or branch you want to set as the new base for the rebased branch.${old_base}
: This represents the commit or branch from which you want to move the branch's commits. The commits between${old_base}
and the branch's current commit will be moved onto${new_base}
.
In other words, this command allows you to change the parent of a specific range of commits in your branch. It detaches the specified range of commits from their original base and applies them on top of the new base commit, effectively rewriting the commit history of the branch.
Using this command can be useful when you want to incorporate changes from a different branch or reorganize your commit history.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.