I'm getting more and more comfortable with git, and I'm learning how to use it with my LaTeX documents. However, I'm not at all a git wizard and thus I'm looking for further advices. One can find many hints and tips around (also in TeX.SE) but I would like to focus on the issue of branching in the context of a TeX document.
I currently I find the model of one-repository-one-document optimal for my needs. By a document lets consider an article for instance. Furthermore, let's assume that the repository is also pushing to a remote location which is shared with collaborators.
My question is: When and How should I branch and merge?
I came up with an idea what should be the workflow, but I'm not sure whether it is good enough, or did I miss something. See my answer.
Best Answer
I hesitate to say this, but I think you're doing it wrong; but you're close to what is, I think, needed.
The purpose of a branch is to separate an activity, not a structural component.
Thus, I would not have a branch for the "Introduction" file, but for the process "Develop the Introduction". This branch might include, for example, changes not only to
Introduction.tex
but also toPreamble.tex
(\usepackage{todonotes}
, maybe) and toMaster.tex
(\input{Introduction}
, maybe).That said, I suspect this is only useful if you're working as part of a team -- one doing the intro, one doing chapters 1-3, one doing chapters 4-8, for example.
As a solitary author, the way I work is this (I use
git
):Where I am building documents that go out to clients, I also do something strange:
gitinfo
)This answer, I hope, may also be helpful: Automatic branching for versions and git