Tutorial: Overleaf and Git (terminal version)

This is the version of our Overleaf/Git tutorial for people who want to use the CLI instead of TortoiseGit.

Downloading Git

Before we get started, you'll need to install Git on your system. On Windows, download it from here and install it. On Linux, just get it from your package manager of choice.

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.

Your local copy is now updated with the changes from Overleaf.

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. Git then inserts some conflict markers in your file that look like this:

blah blah

<<<<<<< HEAD
your version of the sentence
the other version of the sentence
>>>>>>> (ID of incoming commit)

blah blah blah