Command

Git Amend Last Commit Command

The Git command to amend last commit is git commit --amend.

Quick Answer

Command
git commit --amend
GitCommand

Amend Last Commit

Type this command
git commit --amend

Replaces the last commit with staged changes and/or a new message.

Tip: Avoid amending commits you've already pushed to a shared branch.

Learn More

How to amend last commit in Git

  1. Open the terminal or command interface for Git.
  2. Type git commit --amend, replace any placeholders, and run it.

Tip: Avoid amending commits you've already pushed to a shared branch.

Git Amend Last Commit Command

Run git commit --amend.

Related Commands

Frequently asked questions

What is the Git command to amend last commit?

Run git commit --amend.

Where do I type this Git command?

Type it in the terminal or command-line interface used by Git.

Does this Git command work on Mac and Windows?

Yes. The command text is the same on both platforms when the tool is installed.

Official source · How we verify