简体   繁体   English

防止git仓库中的文件被git-tfs检入TFS

[英]Preventing file in git repository from being checked into TFS by git-tfs

I'm working on a TFS repository where check-ins of unnecessary files are strongly discouraged. 我正在开发一个TFS存储库,强烈建议不要检查不必要的文件。

As it stands, some files, like .gitignore , fall into a category of unnecessary ones. 就目前而言,一些文件,如.gitignore ,属于一类不必要的文件。 Is there any way to prevent git-tfs from checking these files into TFS, while still tracking the changes in git? 有没有办法阻止git-tfs将这些文件检入TFS,同时仍然跟踪git中的变化?

I am aware of this solution, but it prevents git itself to refer to the files in question. 我知道这个解决方案,但它阻止git本身引用有问题的文件。 I'm, however, interested in masking the files from TFS check-ins only. 但是,我只对从TFS签入屏蔽文件感兴趣。

No, that's not possible. 不,那是不可能的。 The exact goal of git-tfs is to check in tfs, the exact content of the git commits you've created. git-tfs的确切目标是检入tfs,即你创建的git提交的确切内容。

why .gitignore shouldn't be checked in? 为什么.gitignore不应该签入?

Company policies. 公司政策。

Ahhhhhh, tfs!!!! 啊啊,tfs !!!! The tool that managers impose on their developpers and after throw a spanner in the works by preventing developers to do their works well... Which company tell its developer which file should be put inside its source control :( 管理人员对他们的开发人员施加工具,以及通过阻止开发人员很好地完成他们的工作而在工作中抛出扳手...哪家公司告诉其开发人员哪个文件应该放在其源代码控制中:(

When I was the only one using git-tfs, I used a global .gitignore . 当我是唯一使用git-tfs的人时,我使用了全局的.gitignore Now that all the team use git-tfs, we checked in a .gitignore. 现在所有团队都使用git-tfs,我们检查了一个.gitignore。

But what is the main goal to track a file if you don't want to check it in? 但是,如果您不想检查文件,跟踪文件的主要目标是什么? Putting it outside works perfectly. 把它放在外面工作完美。 I don't see the added value... 我没有看到附加价值......

PS: I'm one of the main developer of git-tfs because I never want to use TFSVC anymore in my entire life.... (frustration occurs and less good job too!) PS:我是git-tfs的主要开发人员之一,因为我一生都不想再使用TFSVC ....(挫折发生,也不太好!)

The way I handle this is by placing the .gitignore file somewhere outside the git repository folder. 我处理这个的方法是将.gitignore文件放在git repository文件夹之外的某个地方。 Then tell your repository to use this file instead with 然后告诉您的存储库使用此文件

git config --local --add core.excludesfile "../.gitignore"

(in this case the actual file resides one folder up from the repository) (在这种情况下,实际文件驻留在存储库中的一个文件夹中)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM