How to locally ignore .git and .gitignore in a svn repo?

久未见 提交于 2021-02-18 10:09:12

问题


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.

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.

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.

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

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


回答1:


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

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.

Direct editing of the config file

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

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

TortoiseSVN UI

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.



来源:https://stackoverflow.com/questions/21156065/how-to-locally-ignore-git-and-gitignore-in-a-svn-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!