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 and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store