2. Git Basics 6. Git Tools 6.4 Git Tools - Rewriting History
Many times, when working with Git, you may want to revise your
commit history for some reason. One of the great things about
Git is that it allows you to make decisions at the last possible
moment. You can decide what files go into which commits right
before you commit with the staging area, you can decide that you
didn’t mean to be working on something yet with the stash
command, and you can rewrite commits that already happened so
they look like they happened in a different way. This can
involve changing the order of the commits, changing messages or
modifying files in a commit, squashing together or splitting
apart commits, or removing commits entirely — all before you
share your work with others. In this section, you’ll cover how
to accomplish these very useful tasks so that you can make your
commit history look the way you want before you share it with
others. Changing your last commit is probably the most common
rewriting of history that you’l