Backlog uses cookies to deliver our services. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

For this tutorial step, we have prepared a repository with some ready made commits to speed things up.

You can download the repository here.

Let's rewrite the first commit in the history log.

Go to the downloaded "stepup-tutorial/tutorial1" directory. Take some time to examine the history of this repository. It should look like the following.

The history of repository.

You can examine the repository's history using the log command.

$ git log
commit 326fc9f70d022afdd31b0072dbbae003783d77ed
Author: yourname <yourname@yourmail.com>
Date: Mon Jul 16 23:17:56 2012 +0900

    append description of the add command

commit 48eec1ddf73a7fb508ef664efd6b3d873631742f Author: yourname <yourname@yourmail.com> Date: Mon Jul 16 23:16:14 2012 +0900

    first commit

Open the sample.txt files and add the bold text below.

Git commands even a monkey can understand
add: Register a change in an index
commit: Save the status of an index

Commit with the --amend option.

$ git add sample.txt
$ git commit --amend

Your default editor should open containing the latest commit message which you can edit. For this tutorial, let's change the message to "Add direction of the Add and the Commit", then save and exit the text editor.

The commit message should now be updated. Use the log command to verify the repository history and the new commit message.

commit --amend
$ git log
commit e9d75a02e62814541ee0410d9c1d1bf47ab1c057
Author: yourname
Date: Mon Jul 16 23:17:56 2012 +0900

    Add direction of the Add and the Commit.

commit 48eec1ddf73a7fb508ef664efd6b3d873631742f
Author: yourname
Date: Mon Jul 16 23:16:14 2012 +0900

    first commit