| 28 | Controlling How You Replay Commits |
Rebasing in Git replays one set of commits on top of another. We
covered the basic case in Task 16, Rewriting History by Rebasing.
There is an interactive mode to git
rebase that lets you control how the commits are
replayed.
Like a regular rebase, git rebase -i
takes the commits in your current branch and replays them against
another point in your repository’s history. You can use this to
change the order of commits, squash commits together, or edit a
previous commit. Consider the following example.
You add a new feature and then start working on the next feature. You realize a little while later that you could have implemented it in a cleaner fashion. You could amend the commit (see Task 35, ...