Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to keep .gitignore files out of SVN?

Tags:

git

svn

git-svn

I'm using git svn to merge changes from my local git repository to an SVN server. However, when I issue git svn dcommit it will actually commit any .gitignore files that I have in my source tree. This is even after I've checked out the SVN repository locally (using SVN), set the svn:ignore property (recursively, listing .gitignore as one of the files to ignore), and then committing that property change directly to SVN.

Is this intended behaviour? A bug? Is there a work around that anyone knows of to keep .gitignore out of SVN?

I just know a non-git user on my team is going to see these files and start deleting them, then the next time I go to rebase/dcommit a lot of unwanted files are going to wind up in SVN.

like image 307
ThaDon Avatar asked Jan 24 '12 18:01

ThaDon


1 Answers

You can use Git's repo-specific "exclude" file, instead of using .gitignore files. The "exclude" file resides at $GIT_DIR/info/exclude (where $GIT_DIR is the Git repository directory, usually .git). The format of this file is exactly the same as that of .gitignore files. The difference is that this is a repository-specific file -- it will only exist in your repository. It will not be propagated to any other repositories (e.g. via git clone or git svn dcommit).

There is no way to omit .gitignore files from the SVN repo, but keep them in Git. Any attempt to do so would result in your local commits not matching the commits that git-svn retrieves from the SVN server. In other words, your local repository's history would not be reconcilable with the history from SVN; they would be permanently out-of-sync.

like image 84
Dan Moulding Avatar answered Sep 21 '22 20:09

Dan Moulding