[Git] How to undo local changes?

How to undo local changes?

使用 git checkout 撤销本地修改

That is, abandon the modification of the locally modified but not yet submitted file, and restore it to the state before the modification

Note: This add/ commitmethod is not applicable to the existing files, the following blog method should be used

After pulling the latest master code, what should I do if I want to roll back the previous version?
https://blog.csdn.net/weixin_43352901/article/details/108705759

The command is as follows

Method 1: Cancel the modification of all modified but unsubmitted files, but excluding newly added files

Insert picture description here

Method 2: git checkout filename 撤销对指定文件的修改,filename 为文件名

Refer to the following blog:

https://blog.csdn.net/Dandelion_drq/article/details/51259831?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.add_param_isCf&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.add_param_isCf

Guess you like

Origin blog.csdn.net/weixin_43352901/article/details/108732694