git commit --amend
CautionFix the last commit
git commit --amend
Folds staged changes into the last commit or edits its message. Coordinate if it was already pushed.
Examples
git add forgotten.txt && git commit --amend --no-editAdd a forgotten file
Syntax
git commit --amend [--no-edit] [-m msg]
Before you run it
Amending pushed commits forks history.
Used when you see
Related commands
- git commitCommit
- git rebaseRebase
- git pushPush to remote
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store