Git - Case Study & Capstone Advice

When working in a Team repository, there are some best practices to avoid merge issues.

  • Don’t commit anything in your teammate’s personal folder.
  • Only commit one notebook at a time, and only something you specifically want to commit and push. Committing everything with * is a common source of problems.
  • Communicate with your teammates about who is working on each notebook in the TeamArtifacts. Only have one person work on it at a time and pass it off explicitly from one team member to another.
    • As long as you are doing the above, you can avoid merge issues by the following before you pull your teammate's work in TeamArtifacts:
      • Temporarily stash your changes: Git stash (these changes should not be in a file a teammate has been working on. Wait until you have pulled their changes to start yours.)
      • Pull your teammates changes: Git pull --no-edit
        The --no-edit flag accepts the default commit message for the merge. If you forget the flag and the editor opens up, follow the instructions here: Git: An Editor Page Opened Up, What Do I Do?
      • Unstash your changes: Git stash pop
      • Make your own commit with git add, git commit, git push
  • Do not commit output in the notebook. This helps prevent some merge issues if a teammate runs the notebook and accidentally commits it again. It also saves space in the repository. Your teammates can run your notebook and generate the output. If they can’t – then your code isn’t reproducible anyway.
  • Do not do work on your personal computer and commit it and push to the remote. Your environment probably has different Python or R versions and this shows up in the metadata in the notebook as a change.

Need more information or help? Reach out to us at 📧 jcwdw@missouri.edu