Note: if you do not have a local repo on your machine yet, and wish to clone an Overleaf project down to your local machine as a new repo, please see this blog post for details.
If you have an existing repository, you can add Overleaf as a remote, just like you would for GitHub or BitBucket. There are a few commands below that you'll need to run to get things started. (The git bridge is still in beta, and we are working on making it possible to skip some of these steps, but until then this process works well.)
To start with, we assume that you have git repo on your computer. (It might also be hosted on github or bitbucket, etc., but you need to have it cloned locally, too).
For this example, it's
$ cd my-paper $ git remote add overleaf https://git.overleaf.com/4551529zqsdhy
(Be sure to use your own link, not the example link.)
If using git 2.9 or later, use the commands:
$ git checkout master $ git pull overleaf master --allow-unrelated-histories
In earlier versions of git:
$ git checkout master $ git pull overleaf master
This will create a merge commit that pulls the blank project from Overleaf into your project.
$ git revert --mainline 1 HEAD
$ git push overleaf master
At present the online edits aren't saved in the git logs every time you make an edit online. The git bridge works this way: when we get a pull or fetch request, the git bridge copies the latest content from Overleaf to a git repo maintained by the git bridge, and then we commit it. In other words, a git commit is generated whenever a user git-pulls or fetches from the project. If you save a version via the History and Revisions menu, and then you do a git pull, the saved version will become a commit in the repository’s git history.
Yes. The only differences are that:
If you have a git repo with both an Overleaf project and a GitHub repo as remotes, the default message for a merge commit will contain the secret link for your Overleaf project. If you are using a public repo on GitHub, please be aware that this will publish the secret link to your project in your commit history on GitHub.
If you would like to keep the secret link secret, you can either make the Overleaf project a Protected Project (available on our Pro plan), so users will require an explicit invite to the project, or use a private repo on GitHub (or BitBucket, etc.).