Reputation: 320
I have a git repo at BitBucket and after 2 hour, I realize that.. I do mistake and need to undo my local working folder with 2 previous commit.
How I can do that? This is my git log
commit fd04cfd1c3ed6a80649f018cffc80acfee8d022c
Author: R <[email protected]>
Date: Sat Sep 19 14:43:44 2015 +0800
theme changed.
commit 11783669c8b8c0dc909dbf15aac085a0c497422c
Author: R <[email protected]>
Date: Sat Sep 19 14:15:27 2015 +0800
Modified.. need to change theme..
commit f1c9df7d7f7aec54942e06b70b4908dbfe7b9f17
Author: R <[email protected]>
Date: Sat Sep 19 08:29:15 2015 +0800
Create 2 testing file for:
- check session level
- check WHOIS session
commit 41828c1d6f984821d5c7b3cb2d0cac269da2b03e
Author: R <[email protected]>
Date: Sat Sep 19 01:05:41 2015 +0800
Prevent others user level and anonymous user from entering PTM level
The commit hash 11783669c8b8c0dc909dbf15aac085a0c497422c are my target to undo all the changes in my local.
Upvotes: 1
Views: 39
Reputation: 398
I assume you like to remove including 11783669c8b8c0dc909dbf15aac085a0c497422c If you want to remove it locally don't want to push reverted checkin then do:
git reset HEAD f1c9df7d7f7aec54942e06b70b4908dbfe7b9f17
git checkout .
and remove newly added files
If you want to push reverted checkin then do:
git revert fd04cfd1c3ed6a80649f018cffc80acfee8d022c
git revert 11783669c8b8c0dc909dbf15aac085a0c497422c
this will two new commits with revert changes
Upvotes: 1
Reputation: 691755
Use git revert
. git revert --help
will explain you what it does and how to use it:
git revert f1c9df7d7f..fd04cfd1c3e
for example.
Upvotes: 0