-
Notifications
You must be signed in to change notification settings - Fork 33
/
github_submit.html
156 lines (118 loc) · 4.68 KB
/
github_submit.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html>
<head>
<title>Algorithms - Github Submission Tutorial</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../slide.css"/>
</head>
<body>
<textarea id="source">
layout:true
<p class="footer">
<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Algorithms: Submitting Assignments with Github</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.datapolitan.com" property="cc:attributionName" rel="cc:attributionURL">Richard Dunks</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative-Commons-License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/80x15.png" /></a>
</p>
---
class: center,middle
![img-center-50](../images/cl_logo.png)
- - -
#Algorithms
##Richard Dunks, Instructor
##Submitting Assignments with Github
---
#Setting up the `upstream` master
```bash
git remote add upstream https://github.com/ledeprogram/algorithms.git
```
--
##You should now have an origin and an upstream remote
```bash
git remote -v #checks for the remotes
```
![img-center-100](../images/github_remote_check.png)
---
#When you start an assignment or want to refresh the code
```bash
git checkout gh-pages #checkout your local gh-pages branch
git fetch upstream #fetches changes to the upstream repository into your local gh-pages
git merge upstream/gh-pages #merges the changes with the upstream gh-pages
git push origin gh-pages #pushes the merged version to the remote (origin) repository
```
--
#Create a branch, commit your changes, and push the branch to your repository
```bash
git checkout -b <branch_name>
git add <file_names> #not git add .
git commit -m 'commit message'
git push --set-upstream origin <branch_name>
```
---
#Create a branch to work in
+ `git checkout -b <branch_name>` creates a new branch locally
+ For assignments, name your branch `<github_username>_assignment_<number>`
+ For do nows, name your branch `<github_username>_donow_<number>`
+ When you `git push`, you'll get an error telling you to set the branch
+ `git push --set-upstream origin <branch_name>`
---
#Make your changes and commit the result
+ `git status` will show the tracked files that have changes and the untracked files (see [the docs for more info](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository))
+ `git add <filename>` the file you want to commit changes of
+ .red[Don't use `git add .`]
+ `git commit -m'my commit message'` to commit the changes
+ `git push` to push changes to **your** remote repository
---
# Key things
+ If you're using an example `.ipynb` file, create a duplicate, don't rename it
+ Name your file properly
+ `<last>_<first>_<class_num>_<assign_numb>.ipynb`
+ Ex. `dunks_richard_1_1.ipynb`
+ .red[If you don't label it right, you didn't do it]
---
#Open a pull request
![img-center-100](../images/github_pull1_box.png)
--
- - -
![img-center-100](../images/github_pull2_box.png)
---
#Make sure
![img-center-100](../images/github_pull2_box.png)
+ Base fork is `ledeprogram/algorithms` and base is `gh-pages`
+ Can merge out of your branch (don't have to merge with your `gh-pages` before opening a PR)
---
#Open a pull request
![img-center-100](../images/github_pull3_box.png)
---
#Open a pull request
![img-center-90](../images/github_pull4_box.png)
---
#Notes on your pull requests
+ Briefly describe any issues, concerns, or questions you had
+ Feel free to provide feedback on the assignments
+ Tag me ([@datapolitan](https://github.com/datapolitan)) or the TAs ([@rashidakamal](https://github.com/rashidakamal) / [@bisaha](https://github.com/bisaha)) if you have anything you want us to flag and look at
---
class:center,middle
#And you're done
---
#References
+ [Github Help "Syncing a Fork"](https://help.github.com/articles/syncing-a-fork/)
+ [Pull Requests from the commandline](https://hub.github.com/)
---
#Some useful code snippets
```bash
#Checkout file from main repository (if you changed a file you shouldn't have)
git checkout upstream/gh-pages path/to/file
#remove a file from your Github and your system after you've made a commit
git rm path/to/file
#remove a directory from your Github and your system after you've made a commit
git rm -r path/to/file
#When first using git, make sure you set the push behavior to simple
#This helps with pushing new branches to Github
git config push.default simple
```
</textarea>
<script src="../js/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
</script>
</body>
</html>