Skip to content

Instantly share code, notes, and snippets.

@ashander
Last active June 23, 2024 04:45
Show Gist options
  • Select an option

  • Save ashander/809fbbcd66c3e714ef59da30f149745e to your computer and use it in GitHub Desktop.

Select an option

Save ashander/809fbbcd66c3e714ef59da30f149745e to your computer and use it in GitHub Desktop.
Using overleaf for realtime (ish) collaboration with an existing git repo

on overleaf.com

  • start a blank overleaf project
  • go to the share menu and copy git link from "Clone with git" (e.g. https://git.overleaf.com/blahblahblaah)

in your local repo

set up overleaf as a remote

git remote add overleaf https://git.overleaf.com/blahblahblaah
git checkout -b collaboration overleaf/master

let's say you want to work on blah.tex. just check it out from your local branch. (you can repeat this for any other files, like library.bib you also want to add)

git checkout master -- blah.tex #
git commit -m "Add blah.tex"

finally, update overleaf. need to use this method for any push to overleaf (because local and remote branch names don't match)

git push overleaf collaborate:master

back on overleaf

do some editing

back in local repo

git checkout collaboration
git pull overleaf master

then integrate the new changes to your master branch

git checkout -b integrate collaboration
git rebase -i master
# squash the commits and write an explanatory message
git checkout master
git merge integrate
git branch -d integrate

with markdown

Overleaf is designed for tex, but it's also an ok real-time plaintext editor. You can do the above with .md or even .Rmd files. (But preview won't work, and you should set it to manual to avoid endless compilation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment