Information Technology Reference
In-Depth Information
Modify the
user.name
and
user.email
configuration settings stored locally in
this particular repository. You can achieve this with:
$ git config --local user.name "John Doe"
$ git config --local user.email
john@example.net
Finally amend the revision following these steps:
1. Modify the contents of lorem.txt with $ echo Lorem Ipsum Dolor > lor-
em.txt
2. Stage the file with $ git add lorem.txt
3. Commit the file with $ git commit --amend -m “Lorem Ipsum Dolor”
The history still contains only one revision. The command
$ git log --
pretty=fuller
prints the output shown in
Listing 8-2
.
Listing 8-2.
The commit created by $ git commit --amend command
commit f63bce5e17a3ba02b0dbee13bb56ceabfd622ce7
Author: Włodzimierz Gajda <gajdaw@gajdaw.pl>
AuthorDate: Thu Aug 22 07:02:00 2013 +0200
Commit: John Doe <john@example.net>
CommitDate: Thu Aug 22 07:07:45 2013 +0200
Lorem Ipsum Dolor
Both revisions, the original and amended, are available through reflog. The com-
mand
$ git reflog
outputs:
f63bce5 HEAD@{0}: commit (amend): Lorem Ipsum Dolor
5a78686 HEAD@{1}: commit (initial): lorem
Therefore, you can always undo what you amended with
$ git reset --hard
HEAD@{1}
.
How It Works