每个工作树的本地排除 [英] Per-worktree local exclusion

查看:66
本文介绍了每个工作树的本地排除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在工作树上使用本地文件排除.我尝试将文件名添加到.git/worktrees/$worktreename/info/exclude,但是没有用.类似的文件.git/info/exclude可以工作,但是适用于所有工作树,而不仅仅是主树.

I'd like to use local file exclusion on a worktree. I tried adding the file name to .git/worktrees/$worktreename/info/exclude but it doesn't take. The analogous file .git/info/exclude works, but applies to all worktrees, not just the main one.

推荐答案

但不需要

应该从该线程开始,但是,如果您使用的是Visual Studio,则不会.确保尝试使用最新的2.16.x版本的Git来查看问题是否仍然存在.

From this thread, it should, but if you are working with Visual Studio, it does not. Make sure to try with the latest 2.16.x version of Git to see if the issue persists.

请注意,我没有在 .git/worktrees中看到info/exclude >官方布局文档.

Note that I do not see an info/exclude in .git/worktrees official layout documentation.

一种解决方法是具有分支特定的.gitignore内容.
这意味着将未跟踪的文件添加到工作树.gitignore仍然是最佳选择.
而且,您可以使用更新索引命令在此处查看,忽略对该(跟踪的).gitignore文件的修改.

A workaround would to have a branch-specific .gitignore content.
That means adding your untracked file to the worktree .gitignore remains the best option.
And you can ignore modification on that (tracked) .gitignore file with the update-index command seen here.

git update-index --assume-unchanged -- .gitignore

这允许您排除所追求的 local .

That allows you for the local exclusion you are after.

这篇关于每个工作树的本地排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆