Skip to main content

✏️ Practice: Rewriting Git History with Rebase

Goal: Now that we've learned about how to change previous commits, let's put this new information into practice!

Warm Up


  • When can you use the git commit --amend command to change a commit message?
  • What are the two things that the git rebase -i command can do?

Code


Complete the following exercise.

Rewriting Git History

Using the process outlined in the "Git: Rewriting History with Rebase" lesson, go back and alter two of the commits from a previous project:

  • Use the --amend flag to change the most recent commit.
  • The rebase command to change any commit other than the most recent. Choose to either reword a commit message or squash and combine two commits.

Everyone in your pair or group should alter two commits.