Excluding Files From Team Foundation Version Control Using .tfignore Files

At one point I was coding on a hobby project, using Visual Studio Online for project management and source control. Because of the technologies involved, a large number of temporary files were being generated that I didn’t want checked in. Visual Studio’s TFS integration is pretty good at automatically filtering these kinds of files out and placing them in the Excluded Changes list in the Pending Changes window, but in my case the sheer number made it a pain to scan the Excluded Changes list for valid changes that I actually wanted to commit.

 

In my case, I didn’t want those temporary files to show up at all – not even in the Excluded Changes list. In order to gain control over which files TFS should ignore completely, I added .tfignore files to my solution. These allow you to specify which files, extensions and directories to ignore (or un-ignore!) from source control. If you’re familiar with the concept of .gitignore files in GIT, you should feel right at home.

 

Example excluded changes view before adding tfignore rules.

You can either manually create a .tfignore file in your solution, or you can add one automatically in Visual Studio by clicking the “Detected” link and then right-clicking on the files under the Excluded Changes list and selecting one of the Ignore options:

 

Creating a tfignore file using the IDE.

Once you select one of the ignore options, a .tfignore file will automatically be added to the root of our solution as a result:

 

A tfignore file in an example solution.

In this case, I chose “ignore by extension”, so this file contains a rule specifying that version control should ignore all files with the .txt extension. This rule will apply to the directory containing the .tfignore file and all subdirectories. The syntax of the rule is simple:

# This rule ignores files with the .txt extension
*.txt

The comment block at the top of the auto-generated .tfignore file provides example syntax for this and other usages such as limiting rules only to the local directory, limiting rules to a specific named directory, excluding an entire directory, and more.

# ################################################################################
# This .tfignore file was automatically created by Microsoft(R) Visual Studio.
#
# Local items matching filespecs in this file will not be added to version
# control. This file can be checked in to share exclusions with others.
#
# Wildcard characters are * and ?. Patterns are matched recursively unless the
# pattern is prefixed by the \ character.
#
# You can prepend a path to a pattern to make it more specific. If you do,
# wildcard characters are not permitted in the path portion.
#
# The # character at the beginning of a line indicates a comment.
#
# The ! prefix negates a pattern. This can be used to re-include an item after
# it was excluded by a .tfignore file higher in the tree, or by the Team
# Project Collection's global exclusions list.
#
# The / character is interpreted as a \ character on Windows platforms.
#
# Examples:
#
#  # Excludes all files ending in .txt in Alpha\Beta and all its subfolders.
#  Alpha\Beta\*.txt
#
#  # Excludes all files ending in .cpp in this folder only.
#  \*.cpp
#
#  # Excludes all files ending in .cpp in this folder and all subfolders.
#  *.cpp
#
#  # If "Contoso" is a folder, then Contoso and all its children are excluded.
#  # If it is a file, then only the "Contoso" in this folder is excluded.
#  \Contoso
#
#  # If Help.exe is excluded by a higher .tfignore file or by the Team Project
#  # Collection global exclusions list, then this pattern re-includes it in
#  # this folder only.
#  !\Help.exe
#
################################################################################

It is important to pay close attention to the scoping of .tfignore rules in order to avoid excluding files unintentionally, as these rules apply recursively to the local directory and all subfolders unless explicitly stated otherwise. In that regard, the final rule in the comment block above is notable in that it allows a .tfignore file in a child directory to override a rule specified by a .tfignore file in a parent directory.

Returning to my earlier example, if I were to add a Documents directory to my solution containing an IncludeMe.txt file, TFS would ignore the text file based on my initial rule. However, I can add a second .tfignore file to the Documents directory with the rule “!*.txt” to override the higher-level .tfignore rule and allow version control to detect IncludeMe.txt:

 

IncludeMe.txt is detected based on the higher-level override rule.

IncludeMe.txt now appears under the Excluded Changes list in the Detected link, allowing me to promote it and include it in source control.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/438157.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

REVERSE-PRACTICE-BUUCTF-18

REVERSE-PRACTICE-BUUCTF-18[SWPU2019]ReverseMe[FlareOn1]Bob Doge[FlareOn5]Ultimate Minesweeper[GKCTF2020]Chellys identity[SWPU2019]ReverseMe exe程序,运行后提示输入flag,输入错误打印“Try again”,无壳,ida分析 交叉引…

VS2008中Web Reference和Service Reference的区别

很早就发现在vs2008中应用web service有两种方式,即Add Web Reference和Add Service Reference,但是一直不是很清楚这两者有什么区别。趁着今天有空实验一下这两者的区别并记录下来供大家参考。 首先在网上查找,发现有如下两个主要区别&#…

REVERSE-PRACTICE-BUUCTF-19

REVERSE-PRACTICE-BUUCTF-19[RoarCTF2019]polyre[安洵杯 2019]game[SCTF2019]Strange apk[CFI-CTF 2018]IntroToPE[RoarCTF2019]polyre elf文件,无壳,用ida分析 main函数的结构,多重循环,是控制流平坦化,参考&#xf…

REVERSE-PRACTICE-BUUCTF-20

REVERSE-PRACTICE-BUUCTF-20[SCTF2019]creakme[网鼎杯 2020 青龙组]bang[WUSTCTF2020]funnyreDig the way[SCTF2019]creakme exe程序,运行后提示输入ticket,无壳,用ida分析 交叉引用字符串“please input your ticket:”来到sub_402540函数 …

Web Reference和Service Reference的区别

今天因为项目需要使用服务引用,就按之前的经验添加上了,步骤如下: 项目根目录——引用——右键——添加服务引用——高级——添加Web引用——输入接口的URL地址——回车(下方出现的就是接口的定义的方法)——修改Web引…

REVERSE-PRACTICE-BUUCTF-21

REVERSE-PRACTICE-BUUCTF-21[SCTF2019]babyre[MRCTF2020]EasyCpp[GUET-CTF2019]encrypt[QCTF2018]Xman-babymips[SCTF2019]babyre elf文件,无壳,用ida分析 在start函数中看到main函数的字样,但是左侧函数窗没有找到main函数 原因是main函数中…

原型设计工具——“墨刀”的介绍与基本教程

一、产品介绍 (1)产品简介: 墨刀是一款在线原型设计与协同工具,借助墨刀,产品经理、设计师、开发、销售、运营及创业者等用户群体,能够搭建为产品原型,演示项目效果。 (2&#xf…

MockPlus原型设计介绍

在第八周的课堂上,王文娟老师在校园系统上发布了对于自行选择的原型设计软件进行资料查找以及自学的任务。因为之前的课程学习需要,我们已经大概掌握了原型设计软件Axure的使用,因此在这里,我选择了另一原型设计进行介绍&#xff…

REVERSE-PRACTICE-BUUCTF-22

REVERSE-PRACTICE-BUUCTF-22[SCTF2019]Who is he[FlareOn2]very_success[NPUCTF2020]Baby Obfuscation[HDCTF2019]MFC[SCTF2019]Who is he unity游戏,运行后输入,点击按钮检验输入 dnSpy打开Who is he\Who is he_Data\Managed\Assembly-CSharp.dll 在Te…

浅谈常见的NoSQL技术方案和选型

前言 在互联网和大数据的背景下,越来越多的网站、应用系统需要支撑 海量数据存储、高并发请求、高可用、高可扩展性 等特性要求。传统的 关系型数据库 已经难以应对类似的需求,各种各样的 NoSQL(Not Only SQL)数据库因此而产生。…

REVERSE-PRACTICE-BUUCTF-23

REVERSE-PRACTICE-BUUCTF-23[2019红帽杯]Snake[BSidesSF2019]blink[De1CTF2019]Re_Sign[ACTF新生赛2020]Splendid_MineCraft[2019红帽杯]Snake unity游戏,dnSpy打开Snake\Snake_Data\Managed\Assembly-CSharp.dll 发现要载入Interface这个dll ida打开Snake\Snake_…

REVERSE-PRACTICE-BUUCTF-24

REVERSE-PRACTICE-BUUCTF-24[watevrCTF 2019]Timeout[SUCTF2019]hardcpp[CISCN2018]2ex[UTCTF2020]babymips[watevrCTF 2019]Timeout elf文件,无壳,ida分析 main函数中signal,alarm,delay三个函数配合使用是为了反调试 交叉引用…

REVERSE-PRACTICE-BUUCTF-25

REVERSE-PRACTICE-BUUCTF-25特殊的 BASE64[FlareOn1]Javascrap[WMCTF2020]easy_re[NPUCTF2020]BasicASM特殊的 BASE64 exe程序,运行后输入,无壳,ida分析 main函数,读取输入,进行变表base64编码,与rightFla…

REVERSE-PRACTICE-BUUCTF-26

REVERSE-PRACTICE-BUUCTF-26[FlareOn6]FlareBear[SUCTF2018]babyre[GKCTF2020]WannaReverse[FlareOn4]greek_to_me[FlareOn6]FlareBear apk文件,模拟器上运行,创建一个小熊,有三种方式交互,分别为“吃饭”,“篮球”以…

C#的变迁史02 - C# 2.0篇

在此重申一下,本文仅代表个人观点,如有不妥之处,还请自己辨别。 第一代的值类型装箱与拆箱的效率极其低下,特别是在集合中的表现,所以第二代C#重点解决了装箱的问题,加入了泛型。1. 泛型 - 珍惜生命&#x…

REVERSE-PRACTICE-BUUCTF-27

REVERSE-PRACTICE-BUUCTF-27[XMAN2018排位赛]Dragon Quest[羊城杯 2020]easyre[watevrCTF 2019]Repyc[2019红帽杯]calc[XMAN2018排位赛]Dragon Quest elf文件,无壳,ida分析 main函数,读取输入,start_quest函数验证输入&#xff0…

C#的变迁史03 - C# 3.0篇

C# 3.0 (.NET 3.5, VS2008) 第三代C#在语法元素基本完备的基础上提供了全新的开发工具和集合数据查询方式,极大的方便了开发。 1. WPF,WCF,WF 这3个工程类型奠定了新一代.NET开发的客户端模型,通信模型,工作流模型。 …

REVERSE-PRACTICE-BUUCTF-28

REVERSE-PRACTICE-BUUCTF-28[FlareOn6]Memecat Battlestation[b01lers2020]chugga_chugga[INSHack2018]Tricky-Part1[watevrCTF 2019]esreveR[FlareOn6]Memecat Battlestation .Net程序,运行后输入weapon code,用dnSpy打开 在Stage1Form直接找到第一个w…

C#的变迁史04 - C# 4.0 之多线程篇

在.NET 4.0中,并行计算与多线程得到了一定程度的加强,这主要体现在并行对象Parallel,多线程Task,与PLinq。这里对这些相关的特性一起总结一下。 使用Thread方式的线程无疑是比较麻烦的,于是在这个版本中有了改善的版本…

REVERSE-PRACTICE-BUUCTF-29

REVERSE-PRACTICE-BUUCTF-29[FlareOn1]Shellolololol[CFI-CTF 2018]powerPacked[INSHack2018]Tricky-Part2[CFI-CTF 2018]Automated Reversing[FlareOn1]Shellolololol exe程序,直接不能运行,无壳,ida分析 简单F8单步调试发现,在…