如何在 svn repo 中本地忽略 .git 和 .gitignore? [英] How to locally ignore .git and .gitignore in a svn repo?

查看:33
本文介绍了如何在 svn repo 中本地忽略 .git 和 .gitignore?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 SVN 工作副本(由 TortoiseSVN 管理).在那个工作副本中,我使用 git 进行本地版本控制和分支.当然,我想隐藏 svn 的 .git 目录和 .gitignore 文件.

I have a SVN working copy (managed by TortoiseSVN). In that working copy I use git for local version control and branching. Of course, I want to hide the .git directory and .gitignore file for svn.

然而,忽略它们意味着向存储库添加一个不再是本地的属性.我不希望那样(因为有很多人共享这个 repo),因为它很烦人,因为它被提议在每次提交到 repo 时提交.

However, ignoring them means adding a property to the repository which is no longer local. I don't want that (as many people share this repo) as it is annoying since it is proposed to be committed on each commit to the repo.

我发现(通过那个 问题) 忽略提交列表的可能性.但是(至少在 TortoiseSVN 中)它只适用于文件:如果我检查修改,repo 会显示修改的属性.但是,我无法将它添加到忽略提交中,因为上下文菜单条目没有显示.

I found (via that question) the possibility of the ignore-on-commit list. But (at least in TortoiseSVN) it just works on files: If I do a check for modifications the repo shows up with properties modified. However, I cannot add it to the ignore-on-commit as the context menu entry just does not show up.

那么,有没有办法(例如通过命令行?)将 repo 添加到 ignore-on-commit 中?

So, is there a way (f.ex. by commandline?) to add the repo to the ignore-on-commit?

还有其他方法可以隐藏/忽略 svn 的 .git 和 .gitignore 吗?

Are there other ways to hide/ignore the .git and .gitignore for svn?

推荐答案

使用 global-ignores 配置选项.SVN Book 的忽略未版本化项目部分 中记录了这一点.

Use the global-ignores configuration option. Which is documented in the SVN Book's Ignoring Unversioned Items section.

此设置将影响您所有的 Subversion 客户端和工作副本,但我怀疑在所有结帐时忽略 .git 和 .gitignore 对您来说不是问题.

This setting will impact all of your Subversion clients and working copies, but I suspect that ignoring .git and .gitignore on all checkouts is not an issue for you.

直接编辑配置文件

在 Unix 上,该设置将应用于 ~/.subversion/config 而在 Windows 上,它将是 %APPDATA%\Subversion\config(尽管它也可以存储在注册表中,查看文档SVN 书).

On Unix that setting would be applied to ~/.subversion/config and on Windows it'd be %APPDATA%\Subversion\config (though it can also be stored in the registry, see the documentation in the SVN Book about that).

默认将被注释掉,如下所示:

The default will be commented out like so:

### 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.
### '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'.
# global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo
#   *.rej *~ #*# .#* .*.swp .DS_Store

您只需要取消注释行并将 .git.gitignore 添加到它们中即可.

You just need to uncomment the lines and add .git and .gitignore to them.

TortoiseSVN 用户界面

在您的情况下,您使用的是 TortoiseSVN,因此您可以避免直接编辑文件并使用 TortoiseSVN 中的设置.在 General 部分下有一个 Subversion 块,其中包含一个标记为 Global ignore 的编辑块模式.只需将 .git.gitignore 添加到模式列表中.这在忽略文件和目录部分的全局忽略块中有所介绍,更具体地说在 设置部分.

In your case you're using TortoiseSVN so you can avoid editing the file directly and use the settings within TortoiseSVN. Under the General section there is a Subversion block with an edit block labeled Global ignore pattern. Just add .git and .gitignore to the list of patterns. This is covered in the Global ignores block on the Ignoring files and directories section and more specifically in the details on the Global ignore pattern setting in the Settings section of the TortoiseSVN documentation.

这篇关于如何在 svn repo 中本地忽略 .git 和 .gitignore?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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