Differences between revisions 1 and 2
Revision 1 as of 2010-08-11 22:48:22
Size: 290
Editor: SamatJain
Comment:
Revision 2 as of 2010-08-11 22:54:08
Size: 484
Editor: SamatJain
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Amend the previous commit that has not been propogated (i.e. undo it, then start a new one with the pending changes in the index):

{{{
git commit --amend -a -m "New commit message"
}}}
Line 7: Line 13:
For a commit that has been propagated, there is no way to undo. However, the following will create a new commit undoing the previous commit's changes: Once a commit that has been propagated, there is no way to undo. However, the following will create a new commit undoing the previous commit's changes:

Amend the previous commit that has not been propogated (i.e. undo it, then start a new one with the pending changes in the index):

git commit --amend -a -m "New commit message"

Undo a commit that has not been propagated:

git reset --hard HEAD^

Once a commit that has been propagated, there is no way to undo. However, the following will create a new commit undoing the previous commit's changes:

git revert HEAD


CategoryCheatSheet

SamatsWiki: CheatSheet/Git (last edited 2023-03-01 08:30:42 by SamatJain)