如何始终阻止签入 TFS 中的特定文件 [英] How can I always block checkin of a specific file in TFS

查看:30
本文介绍了如何始终阻止签入 TFS 中的特定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个文件我总是对其进行更改,但我从不希望被签入.我希望 TFS 阻止我签入或提交更改.如何配置 TFS 来执行此操作?

详情:该项目的另一位开发人员检查了一些我更喜欢在本地机器上注释掉的错误代码.由于他们是客户,我更愿意将其作为技术练习而不是政治练习.

解决方案

TFS 被低估的功能之一是 中,您可以使用.tfignore 文件(相当于 .gitignore for Git)

.tfignore 文件示例##################################### 忽略 ProjA 子文件夹及其所有子文件夹中的 .cpp 文件项目A\*.cpp## 忽略此文件夹中的 .txt 文件\*.文本## 忽略此文件夹及其所有子文件夹中的 .xml 文件*.xml## 忽略 Temp 子文件夹中的所有文件\Temp## 不要忽略此文件夹及其任何子文件夹中的 .dll 文件!*.dll

按权限阻止

另一种方法是拒绝签入文件(需要管理权限):

  1. 右键单击文件> 单击Properties > Security

  2. 添加您的用户并在 Check In 权限上标记 Deny.

There is one file that I always made changes to, but that I never want to be checked in. I would like TFS to block me from ever checking it in or committing the changes. How can I configure TFS to do this?

Details: There is another developer on the project that has checked in some bad code that I prefer to comment out on my local machine. Since they are a client, I prefer to keep this a technical exercise rather than make it a political one.

解决方案

One of TFS undervalued features is cloaking. Like SVN's ignore, cloaking will let you ignore a certain folder or files.

Cloaking a Folder

Cloaking a folder is easy: just right click a folder on the source control explorer and select Cloak

Cloaking a File

The UI doesn't expose cloaking on a single file, but sometimes you may want to cloak a certain file like app.config.

  1. Go to File > Source Control > Workspaces

  2. Select your workspace and click Edit.

  3. Under the working folders, and a new entry with status Cloaked and enter the full server path of the file you want to cloak. (E.g.: $/MyTeamProject/Dev/Src/SomeProject/app.config)


Using Local Workspace .tfignore file (In TFS 2012, 2013, 2015 and up)

In Local Workspace, use you can use .tfignore file (the equivalent of .gitignore for Git)

.tfignore file example
 ######################################
# Ignore .cpp files in the ProjA sub-folder and all its subfolders
ProjA\*.cpp
# 
# Ignore .txt files in this folder 
\*.txt
#
# Ignore .xml files in this folder and all its sub-folders
*.xml
#
# Ignore all files in the Temp sub-folder
\Temp
#
# Do not ignore .dll files in this folder nor in any of its sub-folders
!*.dll

Blocking by Permissions

Another approach is deny check-in on the file (requires administrative privileges):

  1. Right click the file > click Properties > Security

  2. Add your user and mark Deny on the Check In permission.

这篇关于如何始终阻止签入 TFS 中的特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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