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 fetches 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-.gitignores” 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…
I found a solution. You have to use
show-ignoreinstead ofcreate-ignoreand save the output to a file.So after cloning the repository execute following command:
from the repository root where you have the
.gitdirectory.