Pop Quiz

24 Aug 2014

Pop quiz: what does the following command do?

git commit -amend

If you said something along the lines of “modifies the last commit instead of making a new one,” you are not reading carefully enough. Stare at it for a bit before reading on.

At first, you may have confused this with:

git commit --amend

However, without the second dash, it’s equivalent to:

git commit -a -m end

Which stages any modified files (-a), and makes a new commit with the commit message “end” (-m).

One of my coworkers hit this early this week. Fun times.