I'm getting confused with the include/exclude jargon, and my actual SVN client doesn't seem to have (or I've been unable to find it easily) a simple option to add or remove a certain type of files for version control.
我对包含/排除术语感到困惑,而我的实际SVN客户端似乎没有(或者我一直无法轻易找到)一个简单的选项来添加或删除某种类型的文件以进行版本控制。
Let's say for example I've added the entire Visual Studio folder, with its solutions, projects, debug files, etc., but I only want to version the actual source files. What would be the simplest way to do that?
比方说,我已经添加了整个Visual Studio文件夹,包括其解决方案,项目,调试文件等,但我只想对实际的源文件进行版本控制。最简单的方法是什么?
6 个解决方案
#1
60
You're probably safest excluding particular filetypes, rather than picking those you want to include, as you could then add a new type and not realize it wasn't versioned.
您可能最安全地排除特定文件类型,而不是选择要包含的文件类型,因为您可以添加新类型而不会意识到它没有版本化。
On a per-directory basis, you can edit the svn:ignore property.
在每个目录的基础上,您可以编辑svn:ignore属性。
Run
svn propedit svn:ignore .
for each relevant directory to bring up an editor with a list of patterns to ignore.
为每个相关目录打开一个编辑器,其中包含要忽略的模式列表。
Then put a pattern on each line corresponding to the filetype you'd like to ignore:
然后在与您要忽略的文件类型对应的每一行上放置一个模式:
*.user
*.exe
*.dll
and what have you.
你有什么。
Alternatively, as has been suggested, you can add those patterns to the global-ignores
property in your ~/.subversion/config file (or "%APPDATA%\Subversion\config"
on Windows - see Configuration Area Layout in the red bean book for more information). In that case, separate the patterns with spaces. Here's mine. #
at the beginning of the line introduces a comment. I've ignored Ankh .Load files and all *.resharper.user files:
或者,如上所述,您可以将这些模式添加到〜/ .subversion / config文件中的global-ignores属性(或Windows上的“%APPDATA%\ Subversion \ config”) - 请参阅红豆书中的配置区域布局欲获得更多信息)。在这种情况下,将模式与空格分开。这是我的。 #行开头的#引入了评论。我忽略了Ankh .Load文件和所有* .resharper.user文件:
### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
# global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store
global-ignores = Ankh.Load *.resharper.user
#2
5
This can be achieved using the svn:ignore property, or the global-ignores property in your ~/.subversion/config
file. (Scroll to the top of that first link to see instructions on editing properties.)
这可以使用svn:ignore属性或〜/ .subversion / config文件中的global-ignores属性来实现。 (滚动到第一个链接的顶部以查看有关编辑属性的说明。)
By using svn propset
or svn propedit
on a directory, you will be able to make Subversion ignore all files matching that pattern within the specific directory. If you change global-ignores in ~/.subversion/config
's [miscellany]
section, however, Subversion will ignore such files no matter where they are located.
通过在目录上使用svn propset或svn propedit,您将能够使Subversion忽略在特定目录中与该模式匹配的所有文件。但是,如果在〜/ .subversion / config的[miscellany]部分中更改global-ignores,Subversion将忽略这些文件,无论它们位于何处。
#3
2
See blog post svn:ignore.
请参阅博客文章svn:ignore。
I know using TortoiseSVN that I can click on a root folder where I have something checked out and can add arbitrary properties by selecting the "Properties" menu item. In this case you would just specify file patterns to exclude.
我知道使用TortoiseSVN,我可以点击我检查过的根文件夹,并可以通过选择“属性”菜单项添加任意属性。在这种情况下,您只需指定要排除的文件模式。
The blog post for command line stuff, but I'm sure it will work fine with whatever client you're using.
关于命令行的博客文章,但我相信它会适用于你正在使用的任何客户端。
#4
1
At the lowest level, SVN allows you to ignore certain files or patterns with svn:ignore attribute. VS add-ins for SVN such as VisualSVN will automatically ignore those files on your behalf. If you're using TortoiseSVN, you can right-click files and folders in Explorer and choose Add to Ignore List.
在最低级别,SVN允许您使用svn:ignore属性忽略某些文件或模式。 SVN的VS加载项(如VisualSVN)将代表您自动忽略这些文件。如果您使用的是TortoiseSVN,则可以在资源管理器中右键单击文件和文件夹,然后选择“添加到忽略列表”。
#5
1
Another way, when using TortoiseSVN, you can select "Commit..." and then right click on a file and move to changelist "ignore-on-commit".
另一种方法,当使用TortoiseSVN时,您可以选择“提交...”,然后右键单击一个文件并转到更改列表“ignore-on-commit”。
#6
1
Using the svn:ignore
property, you can use wildcards.
使用svn:ignore属性,可以使用通配符。
#1
60
You're probably safest excluding particular filetypes, rather than picking those you want to include, as you could then add a new type and not realize it wasn't versioned.
您可能最安全地排除特定文件类型,而不是选择要包含的文件类型,因为您可以添加新类型而不会意识到它没有版本化。
On a per-directory basis, you can edit the svn:ignore property.
在每个目录的基础上,您可以编辑svn:ignore属性。
Run
svn propedit svn:ignore .
for each relevant directory to bring up an editor with a list of patterns to ignore.
为每个相关目录打开一个编辑器,其中包含要忽略的模式列表。
Then put a pattern on each line corresponding to the filetype you'd like to ignore:
然后在与您要忽略的文件类型对应的每一行上放置一个模式:
*.user
*.exe
*.dll
and what have you.
你有什么。
Alternatively, as has been suggested, you can add those patterns to the global-ignores
property in your ~/.subversion/config file (or "%APPDATA%\Subversion\config"
on Windows - see Configuration Area Layout in the red bean book for more information). In that case, separate the patterns with spaces. Here's mine. #
at the beginning of the line introduces a comment. I've ignored Ankh .Load files and all *.resharper.user files:
或者,如上所述,您可以将这些模式添加到〜/ .subversion / config文件中的global-ignores属性(或Windows上的“%APPDATA%\ Subversion \ config”) - 请参阅红豆书中的配置区域布局欲获得更多信息)。在这种情况下,将模式与空格分开。这是我的。 #行开头的#引入了评论。我忽略了Ankh .Load文件和所有* .resharper.user文件:
### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
# global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store
global-ignores = Ankh.Load *.resharper.user
#2
5
This can be achieved using the svn:ignore property, or the global-ignores property in your ~/.subversion/config
file. (Scroll to the top of that first link to see instructions on editing properties.)
这可以使用svn:ignore属性或〜/ .subversion / config文件中的global-ignores属性来实现。 (滚动到第一个链接的顶部以查看有关编辑属性的说明。)
By using svn propset
or svn propedit
on a directory, you will be able to make Subversion ignore all files matching that pattern within the specific directory. If you change global-ignores in ~/.subversion/config
's [miscellany]
section, however, Subversion will ignore such files no matter where they are located.
通过在目录上使用svn propset或svn propedit,您将能够使Subversion忽略在特定目录中与该模式匹配的所有文件。但是,如果在〜/ .subversion / config的[miscellany]部分中更改global-ignores,Subversion将忽略这些文件,无论它们位于何处。
#3
2
See blog post svn:ignore.
请参阅博客文章svn:ignore。
I know using TortoiseSVN that I can click on a root folder where I have something checked out and can add arbitrary properties by selecting the "Properties" menu item. In this case you would just specify file patterns to exclude.
我知道使用TortoiseSVN,我可以点击我检查过的根文件夹,并可以通过选择“属性”菜单项添加任意属性。在这种情况下,您只需指定要排除的文件模式。
The blog post for command line stuff, but I'm sure it will work fine with whatever client you're using.
关于命令行的博客文章,但我相信它会适用于你正在使用的任何客户端。
#4
1
At the lowest level, SVN allows you to ignore certain files or patterns with svn:ignore attribute. VS add-ins for SVN such as VisualSVN will automatically ignore those files on your behalf. If you're using TortoiseSVN, you can right-click files and folders in Explorer and choose Add to Ignore List.
在最低级别,SVN允许您使用svn:ignore属性忽略某些文件或模式。 SVN的VS加载项(如VisualSVN)将代表您自动忽略这些文件。如果您使用的是TortoiseSVN,则可以在资源管理器中右键单击文件和文件夹,然后选择“添加到忽略列表”。
#5
1
Another way, when using TortoiseSVN, you can select "Commit..." and then right click on a file and move to changelist "ignore-on-commit".
另一种方法,当使用TortoiseSVN时,您可以选择“提交...”,然后右键单击一个文件并转到更改列表“ignore-on-commit”。
#6
1
Using the svn:ignore
property, you can use wildcards.
使用svn:ignore属性,可以使用通配符。