如何在项目中“

编程入门 行业动态 更新时间:2024-10-21 17:24:51
本文介绍了如何在项目中“-假定未更改"文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

git update-index --assume-unchanged local.conf

可以,直到我切换到另一个分支或拉动.

如何在分支之间保留--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.

我希望它可以用作下一个:

  • conf/local.conf已保存
  • 分支已切换
  • conf/local.conf替换为保存的版本
  • 解决方案

    请勿使用--assume-unchanged来解决性能问题,因为大文件不会发生变化,并且执行git status时散列的开销很大. /p>

    您想要的是--skip-worktree,它们可以执行几乎相同的操作,但可以处理您已更改但不想提交的文件.

    请参见 stackoverflow/a/13631525/717372

    这可能(不确定,但是,嘿,那是您必须要做的...)解决您的问题...

    I have config file: conf/local.conf I run next command for it:

    git update-index --assume-unchanged local.conf

    and it is OK until I switch to another branch or pull.

    How to preserve --assume-unchanged flag between branches?

    UPD Some examples what is coming on:

    $ 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.

    I want it works as next:

  • conf/local.conf is saved
  • Branch is switched
  • conf/local.conf is replaced by saved version
  • 解决方案

    Don't use --assume-unchanged that should be used for performance problem for big files not changing and that are costly to hash when doing a git status.

    What you want is --skip-worktree that do nearly the same things but to handle files that you changed but don't want to commit.

    See stackoverflow/a/13631525/717372

    And it will probably (not sure, but hey!, that's what you must do...) fix your problem...

    更多推荐

    如何在项目中“

    本文发布于:2023-07-16 20:16:29,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1125475.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:项目   如何在

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!