Group work for a Monash Research Methods course
1# Git and Github
2
3Git is a version control system that tracks the line-by-line chages to a project in a repository and Github is a website that hosts these git repositories.
4
5This tutorial should cover the basics of working with Git and Github.
6
7## Common Workflow
8
9The common git workflow is as follows:
10
111. `git clone` the repository to your local computer.
122. edit the files (like jupyter notebooks)
133. `git add` the changed files to the staging area
144. `git commit` changes in the staging area to the history(not sure about this word)
155. (optional) `git push` the changes to the remote repository (Github)
166. go to step 2.
17
18***Note:*** `git status` *can be really useful for seeing what the current state of your repository*
19
20**Step 1.** We want to get the repository from Github onto our computer, so that we can make our own changes to the project. To do so, run
21```
22$ git clone https://github.com/Dekker1/ResearchMethods.git
23```
24from whatever directory you'd like to work from.
25
26**Step 2.** *pretty self explanatory here*
27
28**Step 3.** Git uses a staging area to house the changes before committing the changes to the history (much like how you can save the changes to an assignment submission on Moodle without submitting the assignment). Say we've been editing a file, `foo.ipynb`. Use
29```
30$ git add foo.ipynb
31```
32to add these changes to the staging area.
33
34**Step 4.** In order to finalise changes, use
35```
36$ git commit
37```
38and don't forget to write a nice message about the changes made.
39
40
41**Step 5.** In this step we pull the changes from the remote repository and merge them with ours. Then we push the merged changes back up to the master branch of the origin (the remote repository).
42```
43$ git pull origin
44$ git push origin master
45```
46
47**Step 6.** *also self explanatory*
48
49## More Information
50
51- https://www.atlassian.com/git/tutorials
52- The `man` pages of the git commands