Skip to Main Content
Pragmatic Guide to Git
book

Pragmatic Guide to Git

by Travis Swicegood
November 2010
Beginner content levelBeginner
160 pages
2h 50m
English
Pragmatic Bookshelf
Content preview from Pragmatic Guide to Git
35 Fixing Commits

One of the advantages of Git is the ability to “fix” commits. Fixing changes can be as simple as fixing typos that got committed, fixing a bug you didn’t catch because you hadn’t run your unit tests yet, or doing something as complex as rearranging an entire series of commits so they are ordered more logically.

git commit --amend is the way to fix the most recent commit. It comes in handy for those simple fixes that you catch right away. It is a convenience wrapper around using git reset --soft HEAD^ (see Task 37, Resetting Staged Changes and Commits) and git commit -c ORIG_HEAD. You can use the -C parameter with --amend when you want to reuse the original commit message.

You can use git rebase -i to replay the history ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pragmatic Version Control Using Git

Pragmatic Version Control Using Git

Travis Swicegood
Git Version Control Cookbook - Second Edition

Git Version Control Cookbook - Second Edition

Kenneth Geisshirt, Emanuele Zattin(EUR), Aske Olsson, Rasmus Voss
Git for Programmers

Git for Programmers

Jesse Liberty

Publisher Resources

ISBN: 9781680500028Errata