How to solve the problem when the IDEA project code github is updated and local uncommitted changes are overwritten?

When I did git pull today, I found that all the locally modified code was overwritten.

Solution:

Class to be restored -> Right-click -> Local History-> Show History-> Right-click the version to be restored -> Revert
Insert image description here
But there are too many files, and it is very troublesome to restore them one by one. I asked my colleagues and recorded the solution.

  • Right click-》git-》repository-》stash Changes
    Insert image description here
  • Give the content to be saved a name
  • Update code from GitHub
  • Right click-》git-》repository-》UnStash Changes
    Insert image description here
  • Then click Apply Stash

Guess you like

Origin blog.csdn.net/weixin_43589025/article/details/116207428