简体   繁体   English

Git将文件保留在存储库中,但停止跟踪本地更改

[英]Git keep file in repository but stop tracking local changes

I have an app.properties file with dummy values that I have committed and pushed to my Git repository. 我有一个带有虚拟值的app.properties文件,我已经提交并推送到我的Git存储库。 I would now like to tell Git to: 我现在想告诉Git:

  1. Stop tracking changes to my local app.properties file and 停止跟踪对我的本地app.properties文件的更改
  2. Keep the initial app.properties file that was committed to my repository intact. 保留提交到我的存储库的初始app.properties文件。

I have already added *.properties to my .git/info/exclude file, but git status is still detecting any changes that I make to my local app.properties file. 我已将*.properties添加到我的.git/info/exclude文件中,但git status仍然检测到我对本地app.properties文件所做的任何更改。

您可以说使用--assume-unchanged命令将文件视为未更改的git

git update-index --assume-unchanged app.properties

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

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