In “Git Merge and the Multiverse” I looked at merging branches and how sometimes this results in a fast-forward merge and sometimes in the creation of a merge commit. Now let’s look at Git rebase (a.k.a. the power to rewrite history).
rebase
Resolving Git Rebase Merge Conflicts
When performing a Git rebase, I often find myself in the situation where I have one or more merge conflicts. This is how I resolve these merge conflicts.
Git Rebase with Blocks
We can’t do a fast-forward merge when the most recent commit on the receiving branch does not appear in the branch we are merging in. One of our options in this situation is to rebase the branch we want to merge in.
View Current Commit Message during Git Rebase Conflict
When I do a git rebase and I get a conflict, I can use git log to see all the commits rebased thus far. However, I often get confused about what the current (incomplete) commit is that caused the conflict. It would be super helpful if I could see the commit message of the current commit. This command allows you to view the current (incomplete) commit during a rebase.
Git Interactive Rebase Order is Wrong
The interactive rebase feature of Git is one of my favorites. I love being able to squash multiple commits into one commit or re-order my commits for clarity. My one complaint is the Git interactive rebase commit order is wrong (at least for the way my brain works).