mysysgit - How to repeatedly overwrite updates on github?
PHP中文网
PHP中文网 2017-05-02 09:31:25
0
6
859

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! !

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(6)
给我你的怀抱

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

Ty80

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...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template