To revert your changes back to the last working version, i.e. erase what you just did, use
git checkout .To revert your changes to the version multiple commits in the past
Say you are developing a new feature and you realize after few commits that you went off to a way different route that you suppose to and you need to back it up few commits and start over... this definitely would be a cleaner way vs trying to remove what was done manually. How to do it though?Check out what you want and get rid of all that code...
git reset --hard
0d3b7ac32
Then you would push it upgit push origin +master
Pretty simple once you know it.To revert a single file to what's in current git use
git checkout HEAD -- <file_name>
To view the changes between staged and what's in current repo
git diff --cached
fffff
No comments:
Post a Comment