johannix
johannix

Reputation: 29658

Exclude .svn folders within git

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

Upvotes: 69

Views: 41761

Answers (7)

cmcginty
cmcginty

Reputation: 117176

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)

Upvotes: 25

tengzhao201
tengzhao201

Reputation: 31

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

Upvotes: 3

RoloDMonkey
RoloDMonkey

Reputation: 401

This thread has the correct answer:

Git - Ignore certain files contained in specific folders

What you really need is:

.svn*

Upvotes: 30

harryhazza
harryhazza

Reputation: 117

This following structure and .gitignore contents worked for me

  • \.git
  • \.svn
  • \.gitignore

.gitignore contents

.svn/
.gitignore

Upvotes: 5

nils petersohn
nils petersohn

Reputation: 2417

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

*/.svn/*

Upvotes: 2

Andrew Burns
Andrew Burns

Reputation: 14529

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.

Upvotes: 3

Jesse Rusak
Jesse Rusak

Reputation: 57188

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.

Upvotes: 50

Related Questions