Overleaf Git integration


Overleaf is a great tool for collaborating on Latex writing. It’s synced in real-time, has a detailed internal version history, and supports Vim keybindings too. However, it gives me headaches when it comes to the following three things:

  1. It takes ages to compile, especially with large tex files
  2. It’s a pain to upload and manage files through Overleaf’s web GUI. All you can do is to drag, drag and drag…
  3. Although it allows for Vim, local text editors such as Sublime Text are just much better
  4. It’s only online

Git integration

Then I came across the Git integration function of Overleaf. I wish I could have known it much much earlier! It’s a perfect solution to me as it solves all the pain points above.

Essentially, Overleaf acts as a remote host (just like GitHub) so that you can clone your project as a local Git repository. Then you can edit your local repository as much as you can and then just follow all your familiar Git workflows (commit, push, pull) to sync between your local and remote repos. By doing so,

  1. I can compile the tex files much faster, even on my six-years-old Mac
  2. I can use Linux/Vifm to manage all the files in my project
  3. I can use Sublime Text again to edit the tex files more efficiently
  4. I can work offline

For people already familiar with Git, setting everything up is pretty straightforward. Simply follow the instructions by Overleaf here and you are good to go.

Some tips

Some useful tips to make the workflow better.

  1. Compiling tex files locally produces many auxiliary files and you might not want to sync them to Overleaf to make it messy there. Simply use the old trick of adding a .gitignore file. I tested it and it works well with Overleaf
  2. Use relative paths for your tex files so that they are compatible both locally and on Overleaf (or so that you don’t make your coauthors angry)