Collaboration with GitHub

Andrew Irwin, a.irwin@dal.ca

2024-02-27

Plan

  • Collaborating with GitHub and Rstudio

  • How editing conflicts arise

  • Resolving editing conflicts

  • Other workflows

Using a shared repository

Scenario

  • Two people have cloned the repository to their computer and are both editing the same file

One person pushes a change to GitHub

  • What happens when the second person tries to push a change?

One person pushes a change to GitHub

  • What happens when the second person tries to push a change?

Later, the other user pulls the changes

Conflicting edits on the same line can’t be resolved automatically

Conflicting edits on the same line can’t be resolved automatically

Pull, edit, stage, commit, push

Summary

  • The pull - edit - commit - push editing workflow

  • Non-conflicting “simultaneous” edits

  • Conflicting simultaneous edits on the same line and how to resolve them

    • Commit to local repository
    • Pull remote changes
    • Resolve conflicts
    • Stage, commit, and push changes
  • When you start to work on a project, begin by “pull”ing any changes made by someone else

Further reading

Task

  • Work with your team on the project repository. Each team member should edit the proposal file.
    • Clone your project repository to your computer.
    • Edit your project proposal.
    • Stage, commit, and push your changes.
    • Resolve any conflicts that arise – for example, two people editing the same line of a markdown document.