How does Group 5 collaborate in Github
Publish date: Sep 6, 2021Tags: 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
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.Then everyone fork that member’s repository, e.g my repo here(https://github.com/Gaoyuan66/am01).
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.
- 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
- 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
You can run
git add -A
,git commit -m "<ur msg>"
andgit push
after you make changes. The changes will be pushed online in your own repo.Then on the website you may notice the
contribute
button in your repo as follows. You may clickOpen pull request
to let Github detect differences and notice XXX to solve conflicts and merge them.
When others (YYY) made changes
I am ZZZ. I need to make sure all my pull requests have been solved on Github.
Then I just click
Fetch upstream
to the right ofContribute
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.)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 runninggit pull
in the future.Run the following commands on by one in Terminal.
$ git fetch
$ git reset --hard origin/master
When new codes/course materials are published
XXX need to click
Fetch upstream
, and rungit pull
in Terminal.YYY and ZZZ can do the same thing.
Refresh and find what we need.
When we need to upload finalised homework.
- Anyone can keep their folder up to date and upload the html file.