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

标签 git github version-control repository

我有一个 app.properties 文件,其中包含我提交并推送到我的 Git 存储库的虚拟值。我现在想告诉 Git:

  1. 停止跟踪对我的本地 app.properties 文件和
  2. 的更改
  3. 保持提交到我的存储库的初始 app.properties 文件完好无损。

我已经将 *.properties 添加到我的 .git/info/exclude 文件中,但是 git status 仍在检测任何更改我制作了我的本地 app.properties 文件。

最佳答案

你可以用 --assume-unchanged 命令说 git 假设文件没有改变

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

关于Git 将文件保存在存储库中但停止跟踪本地更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28619900/

相关文章:

git - 如何在另一个私有(private) Go 项目(作为模块)中导入私有(private) Go 库(作为模块)

github - 如何为我的项目设置 github 存储库

svn - Grails-未安装SCM提供程序

git 告诉我我的文件被更改了,但我看不出有什么不同

git - 如何在 gitflow 中完成一个分支后检索一个分支

git:移动分支头

windows - Jenkins 错误克隆远程 repo 'origin',从节点

firebase - 如何使用 github 操作和 w9jds/firebase-action 部署到不同的 firebase 环境

git - 修改对共享仓库的 Git 提交

git - IntelliJ 在提交后显示 GIT 差异