84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
比如我先把 github 的项目 pull 下来,然后修修改改,发现“噢,写得有点乱”,一个个删除有点太麻烦了,当然也可以重新 clone 一份下来,但有没有可以重新覆盖更新一份的方法。百度了好久也找不到,新人刚接触,不要嫌弃!!
认证高级PHP讲师
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.
git reset --hard
git fetch && git reset --hard origin/master
Except git reset --hard,也可以考虑使用git checkout .撤销所有文件的修改(新增或删除文件无效),git checkout [特定文件路径]针对某些文件撤销修改,多个路径以空格隔开。另外需注意如果你已经git commit, you cannot use checkout.
git checkout .
git checkout [特定文件路径]
git commit
git checkout file
1. The staging area contains changesgit reset HEAD filegit checkout -- file2. No changes are includedgit 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
There are a lot of searches on this website, how could you not find it? It seems that your search ability...
There are a lot of searches on this website, why can’t you find it? Are you searching for the wrong keywords...
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.
Except
git reset --hard
,也可以考虑使用git checkout .
撤销所有文件的修改(新增或删除文件无效),git checkout [特定文件路径]
针对某些文件撤销修改,多个路径以空格隔开。另外需注意如果你已经
git commit
, you cannot use checkout.git checkout file
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
There are a lot of searches on this website, how could you not find it? It seems that your search ability...
There are a lot of searches on this website, why can’t you find it? Are you searching for the wrong keywords...