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?

2 Answers 2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .