DEV Community

Toolloom
Toolloom

Posted on • Originally published at toolloom.com on

Did You Forget a File? The Git Amend Lifesaver

We’ve all been there: you commit your changes, only to realize you forgot to stage one crucial file or you made a typo in the commit message. Before you create a messy 'Fixing typo' commit, use the power of git commit --amend. First, stage the forgotten file (git add), then run the amend command. This command rewrites the *last* commit, incorporating your new changes or allowing you to edit the message, keeping your repository history clean and tidy before pushing upstream.

Top comments (0)