I am looking up at setting up version control for my latex documents. I was wondering people's typical setup for this. Do they set it up in there top folder or individual projects. I will be using GIT. Specifically can you start a new project that is in a seperate repo (but the same folder as the original GIT) and then merge it into the master branch easily. This would also be useful.
My setup is one repository per document (article/thesis/book/presentation). Advantages, with respect to the "one repository to rule them all":
you can share and sync the individual repositories with the colleagues you are working with. If some of them prefer another version control software, no problem, you use whatever they like.
you can check out previous versions and work in "detached head" mode without screwing up the rest of your home directory.
you can use
you can use tags in a meaningful way
- you need a way to handle files that are shared among projects (if there is any). Git subprojects are a mess.
I can't come up with any more disadvantages --- to me, one repo per project is the way
git is meant to be used. What arguments do the supporters of the "unified repository" have?
Usually I have one git repository per project. Here I need to say, that "project" might be very many single files which compile separately: As example, when I have a lecture to give, I have exercise sheets every week in a separate file, I have a program/syllabus of the lecture, I have todo-notes for myself, I have exams and lists of students for many purposes etc. And ultimately, I might have lecture notes for the lecture still being organized in many different files. But all go into one git-repository. Now I also have a collection of macros I use in many contexts (one repository) and a bibtex collection (another git repository). Finally, for scientific papers I have a git repository for each paper (again, with short notes etc beside the final draft in separate files). This allows to share such a repo with your coauthors who might not at all be interested into you lecture notes on a lecture 5 years ago.
So, I guess it is good to organize things in separate repos in a meaningful way, not necessarily a repo for each file, but for each "project" of files which logically belong together. Once you do that more often, it is a good idea to automatize things by certain templates, Makefiles, and shell-scripts etc.
I also have one per project. Typically also including some Marlab files that create graphics and tables.
I also have a separate project for my matlab toolboxes which I use across several projects. I plan the same for style files and macros I commonly use in LaTeX - though didn't start yet.
I abandoned such a master repo as I want my projects to be "portable". Basically by just making a copy of the folder I have a working repo for at home, or that I can give away. My master repo would easily be some GBs large. Also might include some stuff of projects that I wouldn't want to share.
Large project folder with subfolders. One subfolder is the "GWD" => "Git working directory". Here are all
*.tex-files, which will be under version control. Additionally there will be the
.gitignore file. No other git repositories regarding this project. If I screw it, I'm toast.
One wonderful advantage of using git is that you can create comparisons between e.g. head and any earlier stage of your project by using latexbatchdiff. I wrote earlier about that: Using latexdiff with git