How does Group 5 collaborate in Github

Publish date: Sep 6, 2021
Tags: Efficiency Tools

Purpose

Now although projects are all stored on Github, we still suffer from synchronizing our changes. After following this instruction, we can make changes to our communal homework without facing the problems of failing in git pull or solving file conflicts with each other.

Steps

  1. First we have one group member (named XXX) go to Kostis’s repository(https://github.com/kostis-christodoulou/am01) and click fork on the top right. You may name the repo as you like.

  2. Then everyone fork that member’s repository, e.g my repo here(https://github.com/Gaoyuan66/am01).

  3. Then open terminal (MacOS)/command line (Windows) and go to your working directory by

$ cd <your-directory>
# e.g. $ cd /Users/ygao/Desktop/LBS_courses/

or, create a new R project by clicking New Project in RStudio and provide the repo link as above.

  1. Clone your own repo which you just forked by
$ git clone <url-copied-from-github>
# e.g. $ git clone http://github.com/Gaoyuan66/am01.git
  1. Always open the project by clicking the am01.Rproj so that you don’t have to worry about the working directory.

When you (named YYY) make changes

  1. You can run git add -A, git commit -m "<ur msg>" and git push after you make changes. The changes will be pushed online in your own repo.

  2. Then on the website you may notice the contribute button in your repo as follows. You may click Open pull request to let Github detect differences and notice XXX to solve conflicts and merge them.

When others (YYY) made changes

  1. I am ZZZ. I need to make sure all my pull requests have been solved on Github.

  2. Then I just click Fetch upstream to the right of Contribute on the website of my repo. (Notice: if you have new changes in your repo, you need to open pull request before fetching others’ changes.)

  3. And now make sure my local files are the same as my own repo. (If you want to overwrite your changes on your machine, go to 4 directly.) Run git pull in your folder in Terminal. Since conflicts have been solved on website, so optimistically speaking, we will never see errors when running git pull in the future.

  4. Run the following commands on by one in Terminal.

$ git fetch
$ git reset --hard origin/master

When new codes/course materials are published

  1. XXX need to click Fetch upstream, and run git pull in Terminal.

  2. YYY and ZZZ can do the same thing.

  3. Refresh and find what we need.

When we need to upload finalised homework.

  1. Anyone can keep their folder up to date and upload the html file.