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

15
2009-02-27 04:42:44
git

What Others Think

Thanks, that's genius. I had to make 5 commits because I forgot to add comments :)
Sekenre · 656 weeks and 1 day ago
About 5 commits, you should read more about git rebase..
ab · 604 weeks and 5 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 · 574 weeks and 2 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 · 26 weeks and 4 days ago
You can learn so many such commands from here and it's good to see the details provided here. The details regarding the git command is specified here and If you did forget something, git add the files you want, and then git commit -- amend.It will Disney Treats In California essentially redo the last commit, with the changes you just added. I am looking here for more such command details from here.
Alyssalauren · 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: