打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
How to … Make Subversion ignore files and folders ? Hungry for Knowledge

Excluding files from your repository
Sometimes you may have types of files or folders in your source codetree that you do not want to include in your source code repository.Everyne developing with Visual Studio will immediately know what I mean:VS automatically makes bin and obj subfolders for your project folderin which it puts the buildresults and also creates *.suo files with yourpersonal settings for a solution.

It would be convenient if we could exclude these files from ourrepository once and for all without having to manually uncheck them eachtime we update our project. Fortunatly, Subversion allows us to dothis. In fact, there are two possibilities for exclusion.

Global exclude

With the global exclude we can exclude a certain type of file ofbeing added to any repository to which a certain client connects. To dothis, you must edit the Subversion “config” file which you can find inyour local Application Data folder. A typical location for this file is:“C:\Documents and Settings\[username]\Application Data\Subversion”.

When you open this file, look for the section [miscellany]. In thissection find a line with global-ignores and remove the “#” signes infront of it (if you haven’t removed them allready). Now add the filessignatures you want to ignore.

For example, to ignore the suo files, we would write:


global-ignores = *.suo

Local exclude

The local excludes are made on folders. This means you can tellsubversion clients to ignore a specific file, type of file or folder.This is done by setting the svn:ignore property on the target folderwith the signature of the file or folder to ignore.

For example, to ignore suo files in the solution’s folder, you would perform following command in the folder of the solution:

[TargetFolder]>svn propset svn:ignore *.suo .


Do not forget the final dot, it means that the target folder is thecurrent folder. With the above command Subversion will ignore all fileswith extension “suo” in the target folder.

To ignore folders we have a similar syntax. To ignore for eample a folder “bin” in our target folder execute following command:

[TargetFolder]>svn propset svn:ignore bin .


Again, do not forget the final dot, it means that the target folder is the current folder.

To ignore multiple types of files and folders, you must have anewline delimited list of values for the svn propset command. Becausethis can not be done with the commandline (well, I do not know how to doit anyway), we create a text file with on each line the signature of afile and/or folder to ignore.
For example, we have a textfile with following content:

objbin

We save this file in the target folder and name it “ignore.txt”, and then issue the command in the target folder

[TargetFolder]>svn propset svn:ignore -F ignore.txt .


Again, do not forget the final dot, it means that the target folder isthe current folder. With the above command all folders with names objand bin in the target folder will be ignored by Subversion.

Resources

[1] svn:ignore in the Subversion documentation
[2] global-ignores in the Subversion documentation
[3] Scott Sanders :: blog :: Ignore a file in Subversion (svn ignore) (The inspiration for making this a seperate post)
[4] svn ignore property wierdness

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
TortoiseSVN 操作指南
在linux中如何使用Subversion 和 RabbitVCS
svn指令一览
Subversion Users: Apache2 Subversion SSL install on Debian
全面迎接SVN时代来临
让我的TC也能显示subversion的图标
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服