JAEN

Git

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

Undo a bad commit/push
1
Before pushing, fix it with amend
See the whole flow →

Related commands

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