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:
- It takes ages to compile, especially with large tex files
- It’s a pain to upload and manage files through Overleaf’s web GUI. All you can do is to drag, drag and drag…
- Although it allows for Vim, local text editors such as Sublime Text are just much better
- It’s only online
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,
- I can compile the tex files much faster, even on my six-years-old Mac
- I can use Linux/Vifm to manage all the files in my project
- I can use Sublime Text again to edit the tex files more efficiently
- 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 useful tips to make the workflow better.
- 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
.gitignorefile. I tested it and it works well with Overleaf
- 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)