Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions book/02-git-basics/sections/undoing.asc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ $ git commit --amend

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

[NOTE]
====
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.
Effectively, it's as if the previous commit never happened, and it won't show up in your repository history.

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''.
====

[[_unstaging]]
==== Unstaging a Staged File

Expand Down