Git:让一个用户不要获取/合并对特定文件(否则会被跟踪)的更改
我们有一个文件需要在 Git 存储库中进行跟踪。大多数用户需要正常使用此文件:提交更改、推送、拉取等……
我们有一个用户,此文件会导致各种计算机问题,但无论如何都不会使用此文件。我们希望该用户的存储库完全“跳过”处理该文件。
现在里面的内容都可以保留,但不应获取对其进行的新更改。
我尝试删除缓存版本并将其设置为忽略,但仍然会获取并合并对本地忽略文件的更改。
有人知道如何做到这一点吗?
非常感谢!
-马特
We have a file that we need to be tracked in our Git repository. Most users need to be using this file as normal: committing changes to it, pushing, pulling, etc…
We have one user for whom this file causes various computer issues, and never uses this file regardless. We want this user's repo to "skip" dealing with this file altogether.
Whatever's in there now is OK to stay, but new changes to it shouldn't be fetched.
I tried removing the cached version and setting it to ignore, but changes to locally-ignored files still get fetched and merged.
Does anybody know how to accomplish this?
Thanks so much!
-Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试 git 过滤器驱动程序:
带有涂抹/清理脚本:
smudge
')通过当前内容(保存为另一个文件,准备替换有问题文件的危险内容)clean
')该过滤器驱动程序将在仅在用户必须工作的分支中可见的
.gitattribute
文件。You can try a git filter driver:
with a smudge/clean script:
smudge
') by the current content (saved as another file, ready to replace the dangerous content of the problematic file)clean
')That filter driver would be declared in a
.gitattribute
file visible only in the branch in which the user has to work.