Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  How to undo git changes?

When using git for version control, there is frequent need on undoing commits due to some unexpected changes. This post will introduce how to undo changes with git command in different cases.Undo commitA common undo case is that some commit needs to be reverted as the commit contains error. In this case, the code is already committed. The command to revert the commit isgit revert HEADThis command will add new a commit to the existing head to undo the previous commit. It will not change the previous commit history, hence there is no risk of losing changes.If need to revert multiple commits, run...

3,365 0       GIT GIT RESET GIT REVERT GIT CHECKOUT