Sure. Its almost what I do.
In answer to sub Q1: this is an excellent idea (even if I do say so myself)
In answer to sub Q2: ...
Put the .bib in your Local texmftree
What you would like is a local texmf tree, which in in one git repo.
A local texmf tree is for putting various package-like-artifacts, that are not proper packages managed through your package manager (e.g. Miktex in windows).
The local texmf tree means that you never have to use absolute, or even relative paths for your bibliography. Its also very useful as many conferences and journals distribute their own templates and styles not through CTAN, but just as .sty
and .bst
files.
How to setup a local tex tree is beyond the scope of this answer but it isn't hard. See the following questions:
Once you have created that tree, add it to git.
Put your master.bib
file in localtexmf\bibtex\bib\master_bibliography\master.bib
. (I also have my JabRef XML setting in this directory, and a .tex
file to make an annotated bibliography)
Then when you go to work in a project you just add \bibliography{master}
and it will find it. Better than an absolute or a relative path.
Then when ever you work on a new computer check out the repo from git, and tell your tex distribution to know about the local texmf tree.
Put the Local texmf tree in Git
Now where to put it.
One repo for all work, including the texmftree
I just have one git rep for all my PhD work, with a bunch of folders. Its not a great system, but it is simple. So my texmf tree is in phd\Resources\tools\localtexmf\
. Where as my papers are in phd\documents_prepared\Journal Papers\PaperName
. My experimental prototypes are in \phd\prototypes\ProjectName
. Often I'll have the prototype dump out its data into a CSV, into the a data folder within the Paper folder, then I can produce plots with PGFPlots. (its taken a while for my tex foo to reach that level, but now that it has, it is good)
That's easy and simple. and since it is all on repo, you don't need to worry about committing multiple times.
Keep a git repo for your current work, and a separate for the texmf tree
This is not too complex. There is no need to nest one in the other, as you are not using relative paths or anything (There is also no need not to; see next section). So that is fine.
You just need to remember to commit and pull both.
You could script that.
Use Git sub-modules to nest them
You can have git repos in git repos.
This is a sub-module (Documentation) . I don't particularly see the advantage, except that it does mean someone can just checkout your paper repo, and have it pull the texmf tree git repo as a submodule.
The disadvantage is now you have 1 texmf tree per paper repo, locally. But still only one in git. But keeping them both synced when you are working on multiple projects seems unfun.
git sub-modules don't work the way you might think they do; and for this I don't like them. They might not the least intuitive thing in git, but that is a very competitive playing field (:-P). This post goes into some details. I suggest doing a bit of research before doing this.
P.S. You can use the Bibtex Annote
field to store annotations. If you are using a tool like Jabref, that helps to search and index and generally GUI your .bib file, you may need to enable Annote
on all Bibentry types.
.bib
directly from a remote source (also from a github repo). So there would be no need to have the.bib
in the folder at all. (BTW: I think the general question about how repositories work might be slightly off topic here, I'm quite confident that some people here know the answer, but still ...)