0

I modified some code files and git add git commit. And then, I found some of the modifications were wrong. So how can I reset them in git?

0

Interesting since you mention "reset" in your question but haven't tried to do a reset? Simply do a hard reset:

git reset --hard [revision]

Where [revision] is the SHA1 of the previous commit, or simply HEAD~. It will be as if you never made the commits after that.

0

If it only concerns your most recent commit, git reset HEAD^ might be what you're looking for. It allows to remove certain files from your latest unpushed commit.

Check out this link: http://www.lowlevelmanager.com/2012/04/remove-file-from-most-recent-git-commit.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.