📝
This post is part of my “Shorts” series, where each post is concise and hyper-focused on a single concept.
In an earlier post, I introduced you to the powerful
git-rebase
command. The syntax for the command is:
git rebase <baseBranch>
Rebase on anything
The baseBranch
need not necessarily be a branch. It can be anything - a tag, a commit ID, relative reference
to HEAD
, etc.
For example, if you have a commit with ID as e92aa98f
, you can do:
git rebase e92aa98f
And voila, your feature branch’s base would change to this commit.
To be noted - for next post
The commit ID can be any commit, i.e., it can also be a commit that is already part of your feature branch.
This ability to rebase on any commit is extremely useful for the purposes of rewriting history. You
will find out more about this when I explore the interactive mode of git-rebase
in my upcoming
post.