[英]How do I tell git to ignore my local changes, but leave the file in my remote repo?
Constantly changing my web.config file when testing/pushing to production gets old, so does having to remember to remove that from my staged changes when I don't change the file. 在测试/推送到生产环境时,不断更改我的web.config文件变得陈旧,因此一定要记住,当我不更改文件时,请从我的阶段更改中删除该文件。
I have tried using selecting the "stop tracking" option in Sourcetree (which I think adds the file to my GitIgnore), but that looks like it will remove the file from my remote repo. 我尝试使用Sourcetree中的“停止跟踪”选项(我认为该选项会将文件添加到我的GitIgnore中),但是看起来它将从我的远程仓库中删除该文件。
Is it possible to leave a file in my remote repo, and stop tracking local changes? 是否可以在远程仓库中保留文件,并停止跟踪本地更改?
Use the following command: 使用以下命令:
git update-index --assume-unchanged <filename>
If you want to undo it later, use: 如果要稍后撤消,请使用:
git update-index --no-assume-unchanged <filename>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.