Version Control
Git: Getting started
Git: Getting started
  • Introduction
    • What is version control
      • Distributed VCS
      • Summary
    • What is Git?
      • A Short History of Git
      • Under the hood
      • The Three States
    • What is GitHub?
  • Setting up Git
    • Installation
    • First time setup
    • Creating a repo
  • Basic operations
    • Recording Changes
      • Add another file
      • Modify-stage-commit
      • Modify-direct commit
      • View log
    • Undo changes
      • Restore (modified)
      • Restore (staged)
      • Amend (rare)
    • Clone repos
  • Remote Repos
    • Configure remote
    • Push to remote
      • Push branches
  • Reference
    • My Git Tutorials
    • Git Official
    • Others
Powered by GitBook
On this page
  1. Basic operations
  2. Undo changes

Amend (rare)

Amend

One of the common undos takes place when you commit too early and possibly forget to add some files, or you mess up your commit message.

If you want to redo that commit, make the additional changes you forgot, stage them, and commit again using the --amend option:

git commit --amend

Effectively, it’s as if the previous commit never happened, and it won’t show up in your repository history either!

We need to use Esc + : + "wq" (enter) to exit the message amend screen!

PreviousRestore (staged)NextClone repos

Last updated 2 years ago