简体   繁体   中英

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.

As it stands, some files, like .gitignore , fall into a category of unnecessary ones. Is there any way to prevent git-tfs from checking these files into TFS, while still tracking the changes in git?

I am aware of this solution, but it prevents git itself to refer to the files in question. I'm, however, interested in masking the files from TFS check-ins only.

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.

why .gitignore shouldn't be checked in?

Company policies.

Ahhhhhh, 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 . Now that all the team use git-tfs, we checked in a .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!)

The way I handle this is by placing the .gitignore file somewhere outside the git repository folder. 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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