I want to revert a public repo I recently cloned back to a previous version of itself from a year ago. I don't want to do a hard revert.
I have already tried this:
cd MyRepo
git revert --no-commit dc3b4359..
But I got this error:
error: could not revert dc3b4359...
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
I am a novice at this; what code could be used to do this safely? Thanks in advance.
(EDITED) (thanks @torek)
The most crude way would be:
cd MyRepo
git rm -r .
git checkout dc3b4359 -- .
git add .
git commit -m "Going back in time"
git push origin master
Original answer:
cd MyRepo
rm -rf * # if you have files starting with '.', delete them too.
git checkout dc3b4359 -- .
git add .
git commit -m "Going back in time"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.