How undo a git commit in simple steps

Steps:

Say that you are in your dev branch

git checkout dev
git log

3rd commit 6d2bba2f3a2cde13bce0d3e7e06bc06da71735a4
2nd commit 9b3382b0b2ba1e220db747b9eb0a0d1a9a4322d5
1st commit cabb225b09ba93a22441bf841300904ead51bf28

From the listed commits, say you want to delete the latest one i.e 3rd commit, copy a portion of the hash code &,


git reset --hard 6d2bba2f3a2cde
git push -f origin dev

Advertisements
How undo a git commit in simple steps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s