Skip to content

Instantly share code, notes, and snippets.

@dmurfet
Last active December 25, 2021 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmurfet/fe3915475a39b5fef6bd5027ad22a4cc to your computer and use it in GitHub Desktop.
Save dmurfet/fe3915475a39b5fef6bd5027ad22a4cc to your computer and use it in GitHub Desktop.
Using Git and GitHub for collaboration on writing scientific papers

Getting started

First you'll have to install the Git command line tool on your machine, following these instructions. Then find the repository that you want to contribute to, copy its address from the green "Clone or Download" button, and on your local machine run e.g.

git clone https://github.com/dmurfet/difflinearlogic.git

Committing changes

To see a list of what has changed (optional) run git status. Then

git add *
git commit -m "Changes"
git push origin master

Instead of * you can manually specify the files to be added to this commit. You're also encouraged to use a more helpful commit message than just "Changes".

Fetching changes

Make sure you have committed all local changes before fetching the updates.

git fetch
git merge origin/master

Dealing with conflicts

Usually this isn't a big deal. Edit the file to manually resolve the conflict, re-add and re-commit. See this guide.

Tips

Your workflow should look like this: when you sit down, fetch changes from the server. Make your edits, regularly committing the changes and pushing them to the server. When you've finished, make sure you commit and push one last time. For further help see the GitHub guides.

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