Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
This question actually doesn't need to be Git specific. AFAIK you can have the same structures using the similar Mercurial SCM. For Subversion and similar centralized VCS it may be different. Making a question a little broader can help attracting more answers. –  Martin Scharrer May 6 '12 at 14:58
add comment

4 Answers 4

up vote 13 down vote accepted

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 git archive

  • you can use tags in a meaningful way

Disadvantages:

  • 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?

share|improve this answer
1  
You can use git submodules for handling common files, so this disadvantage is IMO off the table. Or did you mean this by subprojects? –  schlamar May 7 '12 at 11:14
    
@Federico - I was leaning towards this but with the response think it's definately the way to go. Thanks –  J Spen May 8 '12 at 4:43
    
@ms4py: yes, I meant submodules. I tried them, but they had a couple of counterintuitive aspects that put me off at the beginning; it may only be due to my limited experience and git-fu though. But probably I am not alone: note that in the page you link one of the longest sections is "issues with submodules"... :) –  Federico Poloni May 9 '12 at 7:15
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Setup:

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.