In yesterday’s tip, you saw how to visualize a rebase. Today’s tip allows you to practice performing a rebase via the command line.
First, we’ll have master contain one extra commit that isn’t included in your `experiment` branch. For example, you were working on `experiment` and a new commit was added to master (either by you, e.g. bug fix, or from a remote).
Next, you’ll have a commit on `experiment` that isn’t on master.
Since you are on your local machine, you can rewrite history because you haven’t shared or pushed these changes.
From the `experiment` branch, you’ll run
$ git rebase master
and then checkout master and merge in experiment to do the fast-forward merge.
One thing the visualization is able to emphasize is how the commit IDs are different for the “added fileExperiment”.
The commit ID `f041b71` is no longer `1601e09` (as shown in the 2nd image for added fileExperiment).
One thought on “How to practice a rebase on the command line – 112”