Let's learn how to modify an already existing commit
Put an author comment on the page.
FILE: hello.html
<!-- Author: kwikl3arn -->
<html>
<head>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
git add hello.html
git commit -m "Add an author comment"
After making the commit you understand that every good comment should include the author's email. Edit the hello page to provide an email.
FILE: hello.html
<!-- Author: kwikl3arn (kwikl3arn@gmail.com) -->
<html>
<head>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
We do not want to create another commit for adding the e-mail address. Let us change the previous commit and add an e-mail address.
RUN:
git add hello.html
git commit --amend -m "Add an author/email comment"
RESULT:
$ git add hello.html
$ git commit --amend -m "Add an author/email comment"
[master 6a78635] Add an author/email comment
1 files changed, 2 insertions(+), 1 deletions(-)
RUN:
git hist
RESULT:
$ git hist
* 6a78635 2020-01-09 | Add an author/email comment (HEAD, master) [kwikl3arn]
* fa3c141 2020-01-09 | Added HTML header (v1) [kwikl3arn]
* 8c32287 2020-01-09 | Added standard HTML page tags (v1-beta) [kwikl3arn]
* 43628f7 2020-01-09 | Added h1 tag [kwikl3arn]
* 911e8c9 2020-01-09 | First Commit [kwikl3arn]
The new "author/email" commit replaces the original "author" commit. The same effect can be achieved by resetting the last commit in the branch, and recommitting new changes.