I convert a CVS repository to a Git repository with the following command:
$ git cvsimport -vaikd :pserver:[email protected]:2401/ -C IVR-GUI GIT
However, Git ignores the empty directories in the CVS repository. But I want the repository to be cloned including those empty repositories. How can I make Git to do that?
Git cannot track empty directories, so they're not brought over in the CVS-Git conversion. From the Git FAQ: "Directories are added automatically when adding files inside them." Your directories don't appear because Git isn't tracking anything within them.
One workaround to track empty directories is to place an empty file, like .gitkeep
in each empty directory (.gitkeep
is used by convention, but you can name this file anything you want). Track the files, then you'll be able to clone empty directories. There are a few other ways to add empty directories to a Git repository.
The following command will copy all empty directories in your cvs repo to your Git repository (substitute the dummy directory paths)
$ find ~/cvs_repo -type d -empty -exec cp -r {} ~/git_repo/ \;
You can then add these empty directories to your project with your workaround of choice, and follow up with something like $git commit -m "Add empty directories to repository"
.
cvsimport
?Now, I would assume that cvsimport
would compensate for this difference in VCS (CVS lets you track empty directories, Git does not). I don't know anything about the tool, but maybe there's an option you can pass to have it automatically handle adding empty directories.
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