Posted By: Anonymous
git log, I get a list of commits that I have made so far.
commit f5c5cac0033439c17ebf905d4391dc0705dbd5f1 Author: prosseek Date: Fri Sep 3 14:36:59 2010 -0500 Added and modified the files. commit c14809fafb08b9e96ff2879999ba8c807d10fb07 Author: prosseek Date: Tue Aug 31 08:59:32 2010 -0500 Just simple test for core.editor. ... etc ...
How can I revert it back to a specific commit? For example, what should I do if I want to go back to
Is there any other/better way to go back to a specific commit with Git? For example, can I put some label of each commit to get it back with the label?
Do you want to roll back your repo to that state, or you just want your local repo to look like that?
reset --hard, it will make your local code and local history be just like it was at that commit. But if you wanted to push this to someone else who has the new history, it would fail:
git reset --hard c14809fa
And if you
reset --soft, it will move your HEAD to where they were , but leave your local files etc. the same:
git reset --soft c14809fa
So what exactly do you want to do with this reset?
You can add "tags" to your repo.. and then go back to a tag. But a tag is really just a shortcut to the sha1.
You can tag this as TAG1.. then a
git reset --soft c14809fa,
git reset --soft TAG1, or
git reset --soft c14809fafb08b9e96ff2879999ba8c807d10fb07 would all do the same thing.