Skip to content

Commit 73e0797

Browse files
committed
Add a NOTE for "git commit --amend" to emphasize replacement of old commit.
While it might be obvious from that section as to how amending works, it doesn't hurt to truly drive home the mechanics of amending.
1 parent 182a57e commit 73e0797

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

book/02-git-basics/sections/undoing.asc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ $ git commit --amend
3131

3232
You end up with a single commit – the second commit replaces the results of the first.
3333

34+
[NOTE]
35+
====
36+
It's important to understand that when you're amending your last commit, you're not so much fixing it as _replacing_ it entirely with a new, improved commit that pushes the old commit out of the way and puts the new commit in its place.
37+
Effectively, it's as if the previous commit never happened, and it won't show up in your repository history.
38+
39+
The obvious value to amending commits is to make minor improvements to your last commit, without cluttering your repository history with commit messages of the form, ``Oops, forgot to add a file'' or ``"Darn, fixing a typo in last commit''.
40+
====
41+
3442
[[_unstaging]]
3543
==== Unstaging a Staged File
3644

0 commit comments

Comments
 (0)