For example, I first pulled the project from github, and then modified it. I found that "oh, the writing is a bit messy". It is a bit too troublesome to delete one by one. Of course, I can also clone it again, but is there any way to re-clone it? Override a method that updates a copy.
I couldn’t find it on Baidu for a long time. It’s new to me, so don’t be offended! !
给我你的怀抱2017-05-02 09:33:25
git reset --hard
,移除所有未提交的本地改动。git fetch && git reset --hard origin/master
, use the warehouse on github to cover the local area, and the local submissions will also be removed.
It is recommended to back up before use.
滿天的星座2017-05-02 09:33:25
Except git reset --hard
,也可以考虑使用git checkout .
撤销所有文件的修改(新增或删除文件无效),git checkout [特定文件路径]
针对某些文件撤销修改,多个路径以空格隔开。
另外需注意如果你已经git commit
, you cannot use checkout.
PHP中文网2017-05-02 09:33:25
1. The staging area contains changes
git reset HEAD file
git checkout -- file
2. No changes are included
git checkout -- file
Note:
file is the name of your file
git status to view changes in the staging area
git is a website where you can learn it systematically
怪我咯2017-05-02 09:33:25
There are a lot of searches on this website, how could you not find it? It seems that your search ability...
我想大声告诉你2017-05-02 09:33:25
There are a lot of searches on this website, why can’t you find it? Are you searching for the wrong keywords...