Quick Access
Introduction
Git cherry-pick is great when you know which commits you want (and you know
their corresponding hashes) -- it's hard to beat the simplicity it provides.
But what about the situation where you don't know what commits you want?
Thankfully git has you covered there as well!
We can use interactive rebasing for this --
it's the best way to review a series of commits you're about to rebase.
Let's dive into the details...
Interactive Rebase
All interactive rebase means is using the rebase command with the -i option.
git rebase -i
If you include this option, git will open up a UI to show
you which commits are about to be copied below the target of the rebase.
It also shows their commit hashes and messages,
which is great for getting a bearing on what is what. Here is how it may look:
For our purposes, the online editor built a small dialog window that behaves the same way ;)
When the interactive rebase dialog opens, you have the ability to do 3 things:
You can reorder commits simply by changing their order in
the UI (in our window this means dragging and dropping with the mouse).
You can choose to completely omit some commits. This is designated by pick --
toggling pick off means you want to drop the commit.
Lastly, you can squash commits. Unfortunately our levels don't support
this for a few logistical reasons, so I'll skip over the details of this. L
ong story short, though -- it allows you to combine commits.
To finish this level, do an interactive rebase and achieve the order shown in the goal visualization. Remember you can always undo or reset to fix mistakes :D