Add forgotten changes to the last git commit

git commit --amend
It's pretty common to forgot to commit a files, be it a modification, or a brand new file. If you did forget something, git add the files you want, and then git commit --amend. It will essentially redo the last commit, with the changes you just added. It seeds the commit message with the last commit message by default. You probably shouldn't do this if you've already pushed the commit.
Sample Output
Created commit b4f36e5: some log message goes here

2009-02-27 04:42:44

What Others Think

Thanks, that's genius. I had to make 5 commits because I forgot to add comments :)
Sekenre · 641 weeks and 6 days ago
About 5 commits, you should read more about git rebase..
ab · 590 weeks and 3 days ago
git rebase is only useful for VERY limited things, and should not be encouraged for other uses. It can cause more problems than it solves if improperly used.
utoxin · 559 weeks and 6 days ago
It is a good help to make a commit for the git hub community. People are widely looking for it so that they can resolve their best essays issues of synchronizing the data and it will help us to maintain our games data.
hiheqi · 12 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: