如何在项目中使用“--assume-unchanged”文件?

Eug*_*kov 7 git git-assume-unchanged

我有配置文件:conf/local.conf我为其运行下一个命令:

git update-index --assume-unchanged local.conf
Run Code Online (Sandbox Code Playgroud)

直到我切换到另一个分支或拉取之前都可以。

如何保留--assume-unchanged分支之间的标志?

UPD
一些即将发生的事情的例子:

$ git checkout 296-ToS-component 
error: Your local changes to the following files would be overwritten by checkout:
    conf/local.conf
Please commit your changes or stash them before you switch branches.
Aborting
$ git checkout -f 296-ToS-component 
error: Entry 'conf/local.conf' not uptodate. Cannot merge.
Run Code Online (Sandbox Code Playgroud)

我希望它的工作原理如下:

  1. conf/local.conf 已保存
  2. 分支已切换
  3. conf/local.conf 被保存的版本替换

Phi*_*ppe 10

不要使用--assume-unchanged它,应该用于解决大文件未更改的性能问题,并且在执行git status.

您想要的是--skip-worktree做几乎相同的事情,但处理您更改但不想提交的文件。

请参阅/sf/answers/954206781/

它可能(不确定,但是嘿!,这就是你必须做的......)解决你的问题......