简体   繁体   English

覆盖Git中的本地更改

[英]Overwrite local changes in Git

I am a newbie in Git and it is seems a bit challenging. 我是Git的新手,看起来有点挑战性。 I have made changes in a local directory of my repository. 我在我的存储库的本地目录中进行了更改。 These changes are the deletion of a file and the modification of several. 这些更改是删除文件和修改几个。 How can I go back to the initial state before this changes happen?(This is the state when the repository was cloned) 如何在此更改发生之前返回初始状态?(这是克隆存储库时的状态)

You can simply use... 你可以简单地使用......

git checkout .

...which will throw away all dirty changes. ......这会丢掉所有肮脏的变化。

You can clear all local changes by doing this. 您可以通过执行此操作清除所有本地更改。

git reset --hard

https://www.kernel.org/pub/software/scm/git/docs/git-reset.html https://www.kernel.org/pub/software/scm/git/docs/git-reset.html

Note that it is case-sensitive. 请注意,它区分大小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM