Frank Breitling
Frank Breitling

Reputation: 952

Git repository using directory as externals

I have an SVN repository with some documents using the same reference (bibtex) files via svn:externals. Its contents looks like this:

bibtex/
doc1/
-doc1.tex
-bibtex/ (svn:externals)
doc2/
-doc2.tex
-bibtex/ (svn:externals)

This way I could checkout each paper individually and obtaining the same reference. How can I setup the same with git?

I read that submodules were suggested, but if I try (after git svn clone)

git submodule add ./bibtex ./doc1/bibtex

I obtain

fatal: repository '/home/user/repo/bibtex' does not exist
Clone of '/home/user/repo/bibtex' into submodule path 'doc1/bibtex' failed

Upvotes: 2

Views: 52

Answers (1)

VonC
VonC

Reputation: 1326366

You need to make sure bibtex is in its own Git repository. Which is not how svn external is used, since it is a "relative external" link to a folder of the same repository.

Plus, after a git svn clone, you could reorganize your Git repo only if you do not intent to git svn dcommit back to the SVN repository.

If that is the case, then yes, you could:

That is:

cd /path/to/svl-cloned/repo
cd doc1
git rm -r bibtex/
git commit -m "remove bibtex"
git submodule add /url/remote/bibtex/repo bibtex
git add .
git commit -m "Add bibtex submodule"

Upvotes: 1

Related Questions