Why would I need to use version control with my LaTeX documents? I know people who do it, and I've seen questions about it on here and on SO, but I haven't understood what value there is to doing it...
[Maybe this should be CW?]
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityAs a single user the main advantages are
I'm also someone who uses version control as a single user. All of Caramdir's reasons are ones that I agree with, and I'll add the following:
Incidentally, I switched to using a version control system around about the time I started taking online notes of everything that I did. So I wrote up some notes on the process here. I also found an article (also available as a wikibook) on the subject that was very helpful to me in deciding to switch to a version control system and on what to look for in one.
Using revision control makes you unafraid to make radical changes to your document. As one of my friends, Peter Boothe, put it,
you can now freely throw away bits and pieces, secure in the knowledge that if you actually want them back, they are there in the revision control system. Interestingly, almost nobody actually uses this feature. Revision control systems are not there to save your old work. They are there to give you permission to throw that old work away.
\end{document}
. Now I no longer have to do that.
Aug 15, 2010 at 16:28
For me, one of the main reasons for using a VCS is to avoid cluttering my working directory with lots of mainly useless files with cryptic filenames like:
mydocument20103001.tex
mydocument20103001aa.tex
mudocument20091221.tex
mydocument20091221jonsversion.tex
With such a system, it is hard to keep track of which changes occurred in which version. It gets worse if you have multiple authors collaborating on a document with different file naming conventions. It gets even worse if you are using a similar system for your bibtex and image files, as you have to keep remembering to update the references to the files in the main document. It gets even more worse if you are collaborating via sending email attachments and don't know for sure that you have saved every single version that was emailed into your working directory.
With a VCS you just have one copy of each file, so you have a much cleaner and easier to navigate working directory. The VCS should make it easy for you to find out where changes were made, so that you can easily find things when you want to restore something that you previously edited out. Since the VCS stores everything, you know that every version of the file is available in one place. It should also declutter your email inbox a little bit as you won't need the attachments and emails that just announce updates to the document are no longer needed.
The same advantages you get of using version control for any other kind of documents.
Helps for many people to collaborate on a single document/project, keeps track of all the changes to the document as it evolves, you can revert and/or merge edits.
Version control systems also let you work on several machines. For example, I git push
before going home, and when I get there and want to finish my work, I start with git pull
. This is a lot easier than transferring files to a USB key, or scp
ing them, or using dropbox, etc.
git push
and git pull
easier than doing nothing?
It's also handy to automatically include a version/revision number from your VCS into the output of your document. Then when you're look at the output or hardcopy you can tell if it's out of date or how to re-construct the exact input files.
It doesn't matter whether it's a document or computer program source code. The benefits of VCS are the same. For me the compelling reason is the ability to study and track change over time. It's just like having a time machine.
Version control systems are also very useful to view differences between versions of a document.
This functionality is only relevant for files in plain text format, but thanks god, you use *TeX :)
If you haven't used a version control tool before, I seriously recommend you start using one. Otherwise you will version control manually i.e. paper-v5, paper-v6 etc which may be sufficient for one-off, short-term projects.
You can see version control as recording a (discrete) history of your project allowing you to associate notes with the changes you make and to inspect at later stage why they were made. This might sound cumbersome but most good editors let you seamlessly integrate it into your workflow. In fact you will soon find version control tool indispensable.
For why this is needed, look at the other (very good) answers. I would like to add that I use DropBox for my LyX documents. It does pretty much what you would get with a VCS (without branches/merges etc. - but as a single use for a document, you probably won't need it), but it does that automatically. It syncs your files between computers and it makes your documents available to you online.
Though an old question, I recomend using Git. It works fine and is incorprated today for shared projects inside Github, Gitlab or Gitea (free). One striking argument I found near the cover of book "Git". So for curiosity reasons, not for advertisement, let's have a look at it:
Version, commit, change, status, statistics, branch, fork ... all daily routine with Git. Turns out said book was written by two authors (using Git) with ... Latex. Some background:
As an aside the mentioned online plattforms Github, Gitlab, Gitea and others, add management capabilities on top of Git: that's their added value besides proliferating code. Management in this context means e.g.:
Hope this helps :)
I agree with the others, but the most "non technical" reason is to think about it as "unlimited undo" between the versions that was saved in the VCS.
You can always get a old version back regardless what you do.
This is the meaning of the "automatic backup" that is a little bit tricky to understand.
SubVersion is a simple to understand system, that works well for small teams.
Git on the other hand is is more technical advanced and scales better, but for small teams this is a academical question.
But the point is that any VCS is better than not using this type of systems at all.
git diff --color-words
and you'll see diffs at word level.