Monday 31 October 2016

publications - Why use version control systems for writing a paper?



I am following the advice of @Piotr Migdal in Is there an internet Git-like repository for collaboration on a paper?, and I want to ask about version controls: how beneficial are they (specially under LaTeX settings) for writing papers compared to Dropbox and SugarSync?


I have been using SugarSync for almost a year with no pain. Usually, I create the paper folder and invite other authors to join, so we can see and edit the last version of the paper.



Answer



tl;dr: Version control is harder to set up, but makes it safe to work on the same file, and makes it easy to track history (i.e. previous versions).


Pros and cons of syncing files


Yes, the biggest advantage of things like Dropbox (I use it as well for backuping and synchronizing my files) and SugarSync is their easiness.


They may work for collaboration on files, but:



  • they are not meant for two people editing the same file at once (no merge functionalities - so one guy changing a file can overwrite changes made by other guy, even without knowing that),

  • you get no history, i.e.:


    • did anyone worked on that file I want to work know?

    • did anyone added or modified any other files?

    • which changes were made?

    • can I go to a previous version, the one I sent to my supervisor?




Depending what you do, it may not be an issue. For example, if only one is editing tex file, while others are only reading or uploading figures - it's perfectly fine.


And also, look at my answer on Simplest way to jointly write a manuscript? with a not technically-inclined collaborators.



Version control


Version control systems require some technical skills.


Two the most common version control systems are Git and Mercurial (with the second one being more Windows-friendly and, arguably, easier to start).


Both by standard comes only with command line access, but there are some graphical interfaces as well (I really recommend starting with SourceTree).


So, if the collaborators are techie, just teach them how to use it. If not - there is a way around.


You can keep track of version control by yourself, without engaging others (I'm doing it just now with 2 collaborators).


Just you start a repository inside folder you share (the examples are with Git):


cd ~/path/to/the/folder
git init // start git repository inside this folder
git add . // say git to track all files inside it


Now, every time you or your collaborator make some changes (e.g. add some files, correct typos, revise a chapter, ...) you do:


git commit -a -m "Fixed typos in Seciton 3"

Later, you will be able to go back to this version; and also compare, e.g. the current version of your file with the previous one (by default - by line, here - by words):


git diff HEAD~1 --color-words my_file.tex

See also:



And real world example from using diff (it makes my life so much easier :)); commit messages in Polish, but I guess you get the idea:



enter image description here


enter image description here


Otherwise (a strip from PhD Comics):


enter image description here


No comments:

Post a Comment

evolution - Are there any multicellular forms of life which exist without consuming other forms of life in some manner?

The title is the question. If additional specificity is needed I will add clarification here. Are there any multicellular forms of life whic...