Storm Spirit Storm Spirit - 1 year ago 130
Git Question

How to undo on selected commit

I want to undo on selected commit. Cause my team push different many files and many commits.

What I did was pull with deleted files. now my files gone also.

I tried this

git rebase -i 4dd0c29
git reset --hard undo

but nothings changed

Answer Source

Use command git log in project's main git directory to get recent commits. Most recent commit will be shown up first. It will also log commit number in long format. For example:

commit ed7cec151e25ea7f9e0d0563598ee9afd3170952
Author: xxx <>
Date:   Thu Jul 28 17:25:51 2016 +0500

Then hard reset all changes using your commit ID:

git reset --hard ed7cec151e25ea7f9e0d0563598ee9afd3170952

Hope it helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download