1 Objective

This guide is indented for people who do not use Git and provides bare minimum to get started.

If you know Git you can read Overleaf manual.

Why Git for Overleaf:

  1. simply backup whole project history on your local machine
  2. work off-line and synchronize changes
  3. be able to go back to previous versions of your work

In this tutorial we will show how those three things can be done.

In order to start download and install Git from this website.

We will use command line interface in this tutorial but you can use GUI client if you prefer.

Below we go through the three actions described above in the following sections.

2 Back up whole project history

  1. Click on Share option in top tool bar in Overleaf and copy Clone With Git link to a clipboard;
  2. Open your system console and switch to a directory where you want to clone your project to;
  3. write git clone [copied link] [directory] and run the command (git must be in a search path for this command to succeed);
  4. You are done! you have the full repository of your project cloned to directory subdirectory.

Later if you want to get current version of changes of repository to your local machine execute git pull in command line in the directory directory.

3 Work off-line and synchronize

  1. Run git pull to synchronize your repository;
  2. Make changes in local project files;
  3. If you did not add any changes simply run git commit -am "describe your changes";
  4. If you have added new file you have to write git add [file name] before running git commit;
  5. Run git push to send your local changes to Overleaf;
  6. You are done and have the same version in both places.

4 Go back to previous version of work

This can be tricky. We will describe bare minimum here.

  1. Start with your project being committed and synchronized with Overleaf (perform pull or commit and push commands as described above before you start messing with history)
  2. Write git log, you will get a list of entries starting with something like:
> git log
commit 0d9fb31065757a9663e103e9f0131a131975daf1
Author: Bogumił Kamiński <bkamins@sgh.waw.pl>
Date:   Thu Aug 3 22:16:35 2017 +0200

    Trigger CI with fixed Documenter

commit 67f61c362fcf508ac26811060bf26edd9f08aacb
Author: Bogumił Kamiński <bkamins@sgh.waw.pl>
Date:   Sun Jul 2 15:01:07 2017 +0200

    fix SubString construction and test improvements
  1. Find a commit number (hexadecimal number after word commit) you want to get to in the log. It is usually enough to copy first 8 hexadecimal digits.
  2. Now write git checkout [commit number] and see the old version. Do not modify the files (if you want you can save them in a separate directory and modify them there)
  3. When you are done write git checkout HEAD to go back to the latest version you have (after this you are in synchronized with Overleaf again).

Git provides a lot more functionality (you can edit older versions etc. but this is a more complex topic).

5 The end

This is all you need to know to get started. For me it covers 99% of cases in daily work.

For more advanced Git features refer to its documentation or use GUI Client of GIT.