TutorialsOverleaf and Git

Overleaf supports integration with Git, which is useful when you want to edit your documents offline and upload your changes later. This tutorial does not explain how Git works in general; it demonstrates only how to get a local copy of an Overleaf project, and when you're done editing, how to upload it back to Overleaf. We tried to imitate an SVN-like workflow here; note that this is not necessarily the most convenient way to work with Git.

This tutorial assumes you're using a Windows system and want to use a GUI. (If you'd rather use a terminal, see here.)

Downloading Git

Before we get started, you'll need to install Git on your system. First download Git itself here and install it. Furthermore download TortoiseGit from here and install it. (In the first-run wizard, make sure you fill out your name and email address; this is how Git identifies you.)

Cloning a project

The goal here is to make a local copy of your project, so you can edit the files offline (make a clone, in Git terminology).

You should now have a local copy of the project.

Updating an existing local copy

Now if someone else makes an edit, and you want to have those changes reflected locally, it isn't necessary to clone the project from scratch. Instead you can just download (pull) the changes into your local copy to bring it up-to-date.

Note At this point, you know everything you need in order to use your local copy as a backup. If you also want to make changes locally and push them back to Overleaf, please continue reading.

Make your changes

First, make some (hopefully useful) changes to your paper. We can't help you with that part ;)

After you made a change, you can commit it.

Note that at this point your change hasn't been uploaded to Overleaf yet; you added the change only to your local clone.

Push the changes back to Overleaf

To upload (push) your commits so others can see your changes, perform the following steps.

The change should be (almost) immediately visible in Overleaf's web interface. Success!

Merge conflicts

If you pull a commit and Git cannot merge it with your local commits (probably because you both edited the same sentence of a file) you have to merge manually.

Tips