Exclude .svn folders within git

SvnGit

Svn Problem Overview


I'm trying to exclude subversion's folders from being tracked by git. I tried a couple different setups for .git/info/exclude, but it doesn't seem to work. I would use git-svn, but it's a pain to request access to get that to work, so I'd rather just work around this by excluding the folders.

I want to exclude ".svn/entries"

I've tried adding the following lines to .git/info/exlude: .svn entries .svn/entries entries svn

No matter what I try, .svn entries shows up when I run git status

Svn Solutions


Solution 1 - Svn

I think you want to use a .gitignore file in your top-level directory. This will work if you put ".svn/entries" on a line in that file. You might just put ".svn" instead of ".svn/entries" as well.

EDIT: See comments. If they files are already being tracked by git, they'll always show up in git status.

Solution 2 - Svn

This thread has the correct answer:

https://stackoverflow.com/questions/971465/git-ignore-certain-files-contained-in-specific-folders

What you really need is:

.svn*

Solution 3 - Svn

Put ".svn" in a ~/.gitexcludes file. Then tell git about it:

echo '.svn' > ~/.gitexcludes
git config --global core.excludesfile "/home/USER_NAME/.gitexcludes"

(Make sure you change USER_NAME so it points to your home directory)

Solution 4 - Svn

This following structure and .gitignore contents worked for me

  • \.git
  • \.svn
  • \.gitignore
.gitignore contents
.svn/
.gitignore

Solution 5 - Svn

Do what Casey suggests, except name the file .gitignore and put it in the root of your git repo.

I also like to do a attrib +h .gitignore so it won't show up in my explorer windows.

Solution 6 - Svn

if you want to keep the svn directory.

you may run the following first:

for dir in $(find ./ -type d -name \*.svn); do git rm --cached  -r $dir; done;

and then run echo ".svn" >>.gitignore in the root directory

Solution 7 - Svn

since every versioned folder has a .svn directory you have to put:

*/.svn/*

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjohannixView Question on Stackoverflow
Solution 1 - SvnJesse RusakView Answer on Stackoverflow
Solution 2 - SvnRoloDMonkeyView Answer on Stackoverflow
Solution 3 - SvncmcgintyView Answer on Stackoverflow
Solution 4 - SvnharryhazzaView Answer on Stackoverflow
Solution 5 - SvnAndrew BurnsView Answer on Stackoverflow
Solution 6 - Svntengzhao201View Answer on Stackoverflow
Solution 7 - Svnnils petersohnView Answer on Stackoverflow