Let's pretend we need to redo the latest commit because we need to reword the commit message to include a reference to the issue tracker.
- Let's first take a look at the latest commit and make sure the working directory is clean:
$ git log -1 commit 3061dc6cf7aeb2f8cb3dee651290bfea85cb4392 Author: John Doe <john.doe@example.com> Date: Sun Mar 9 14:12:45 2014 +0100 Adds Java version of 'hello world' Also includes a makefile $ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean
- Now, we can redo the commit and update the commit message with the git commit --amend command. This will bring up the default editor, and we can add a reference to the issue tracker ...