How to perform the TFS-equivalent of 'Undo pending changes'

后端 未结 4 1125
春和景丽
春和景丽 2020-12-23 20:40

How do I perform the equivalent of the TFS \'Undo pending changes\' in Git, on one or multiple files?

That basically means to do these steps:

  • Undo chan
4条回答
  •  我在风中等你
    2020-12-23 21:10

    This command will undo local changes and restore them to the current versions in the repository:

    git reset --hard
    

    You can revert to your last valid commit by issuing:

    git reset --hard HEAD
    

    If you just want to restore just one file, use git checkout instead:

    git checkout -- file_name.extension
    git checkout HEAD file_name.extension
    

提交回复
热议问题