Skip navigation.

gnapse corner

web for everyone

Oops!

You made a mistake? No problem, with Git you can rewrite history!

I made a mistake in my last commit and I figured that out too late. Well, not late enough, because thanks to git I was able to amend my last commit with whatever new changes I wanted and git's commit history appeared as if the mistake was never there.

Here is how it works.

You commit and then you figure out you made a mistake, maybe a mispelled word in your commit message or even a programming error, whatever. So you change whatever you want, add the relevant stuff to your index with "git add" and then

$ git commit --amend

which opens your editor with the message of your last commit pre-loaded, which you can edit if you need and then save it. That's it. Your new changes will appear as if they were always there on that last commit, no new commits in your history with the fixes of your mistakes.

I LOVE GIT!!!

Resuming my tech (b)logGmail 2 now works in Opera!

Comments

zenya 25. June 2008, 23:09

where do you get " GIT" :D

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

Type the two words displayed in the image below:


Smilies

July 2009
M T W T F S S
June 2009August 2009
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31