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...
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.
The . gitignore file's purpose is to prevent everyone who collaborates on a project from accidentally commiting some common files in a project, such as generated cache files. Therefore you should not ignore .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With