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
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
To revert a specific commit, use git revert <commit>
This will create a new commit where the content of <commit>
has been reverted.
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 <xxx@email.com>
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.
Use git reflog
it will give you a list with log of the activities which changed HEAD
. Find HEAD@{id}
(where id
is a number) which indicates at the head prior to git pull
and then do git reset --hard HEAD@{id}
(make sure replacing word id
with the number of the HEAD
)
Alternatively, you can do git reset --hard HEAD^
this will revert your HEAD
to previous state it was in prior to git pull
.