How to get a single .gitignore after git svn create-ignore

git, git-svn, svn

Solution

I found a solution. You have to use `show-ignore` instead of `create-ignore` and save the output to a file.

So after cloning the repository execute following command:

git svn show-ignore > .gitignore

from the repository root where you have the `.git` directory.

Problem

I have imported SVN repository with Git using: ``` git svn clone --preserve-empty-dirs --stdlayout svn+ssh://... SVN.git ``` It did succeed in the end although on the way it did fail few times and I had to "restart" with ``` git svn fetch ``` Yet it seems in the end everything is fine. (Although now when writing I start to wonder whether I should have provided `--preserve-empty-dirs` in the additional `fetch`es as well? EDIT: No, I should not. See my comment bellow.) Then I wanted to create `.gitignore` and so I did with ``` git svn create-ignore ``` And this succeeded as well. But the end result is less than satisfying. It did generate lots of `.gitignore` files in many folders. It seems that each time when SVN had a `svn:ignore` property Git created corresponding `.gitignore` file. While I would like to have them merged into a single root `.gitignore` file. This is possible with git since its far more flexible with ignores allowing to ignore in sub-directories with wildcards (or without them). Any way I think it is possible to automatically transform those "sub-`.gitignore`s" into a single one at the root. And I would like to have that because "SVN people" would not be happy with me committing over twenty `.gitignore` files...

Original source