You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 503bf43
Browse filesBrowse the repository at this point in the historyBrowse files
@@ -24,9 +24,10 @@ A software development project is all about continuous improvement:
24
24
25
25
Steps 3-4 will be repeated multiple times until the development team (which could even be a single developer) deems it is ready for release.
26
26
27
-
In this course, you will not only learn about Python but also about the development process that most Python projects go through. GitHub Classroom allows for the steps indicated above to be completed in an academic environment.
27
+
In this course, you will not only learn about Python but also about the development process that most Python projects (and virtually any other programming language) go through. GitHub Classroom allows for the steps indicated above to be completed in an academic environment.
28
28
29
-
Initial setup
29
+
30
+
Initial Setup
30
31
=============
31
32
32
33
You will need an account on GitHub to participate in this course.
@@ -39,44 +40,224 @@ You can find instructions for setting up git (and the rest of your development e
39
40
40
41
Once you have all the tools set up, you will need to create a folder (directory) within your development system for keeping your work.
41
42
This is the folder where all your assignment repositories will reside. It will be helpful to keep them all together in one place.
43
+
This folder (directory) should be somewhere in your "user" or "home" directory.
42
44
43
45
44
-
Accepting an assignment
45
-
=======================
46
+
Accepting an Assignment
47
+
-----------------------
46
48
47
-
Each assignment page will contain a section named "Accepting your Assignment". Click on the corresponding link, which will take you to GitHub Classroom to accept the corresponding assignment.
49
+
On each assignment page there should be a link to the assignment on gitHub classroom. Click on this link, and it should take you to gitHub classroom, and allow you to "Accept this Assignment".
48
50
49
-
.. note:: The first time you accept an assignment, gitHUb will "invite" you to join the class organization. You will need to click the link to accept the invitation. ONce you have done that once, you shouldn't need to do it again.
51
+
.. note:: The first time you accept an assignment, gitHub will "invite" you to join the class organization. You will need to click the link to accept the invitation. Once you have done that the first time, you shouldn't need to do it again.
50
52
51
-
Some things to consider:
52
-
------------------------
53
+
Some Things to Consider
54
+
.......................
53
55
54
56
* You will need to accept each assignment separately.
55
57
56
-
* Accepting an assignment will trigger the creation of a private repository for you to work on your assignment.
58
+
* Accepting an assignment will trigger the creation of a new gitHub repository for you to work on your assignment. That repository will be in your gitHub account. By default it is "private", so that only you and the instructors will be able to see it.
57
59
58
60
* This repository is only assigned to you.
59
61
60
62
* Any work you do there will not affect the work of your classmates.
61
63
62
64
* The name of the new repository will include your GitHub user name at the end.
63
65
64
-
Once your repository has been created, go to its link and clone it on your development system, under the folder you selected for this purpose.
66
+
Once your repository has been created, go to its link (provided by gitHub) and clone it on your development system, under the folder you selected for this purpose.
65
67
66
68
Here: `Cloning a repo <https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository>`_
67
69
is GitHub's official guide on how to clone a repository.
68
70
69
71
70
-
Before You Start Working on your Assignment
71
-
===========================================
72
72
73
-
Once your repository is setup, it's good to get familiar with your repository view.
74
-
You should see a tab there called "Pull Requests": they indicate code changes that are desired to be pulled into a main repository.
75
-
By default you should see one already there called "Feedback". Go ahead and click on it, and take a look at "Files Changed" tab - as of now it should show "No changes to show". As you start committing your code you will see your changes there.
73
+
.. _github_classroom_workflow:
74
+
75
+
GitHub Classroom Assignment Workflow
76
+
====================================
77
+
78
+
The following is the workflow you will need to follow for each individual assignment.
79
+
80
+
81
+
Accept the Assignment
82
+
---------------------
83
+
84
+
The first step is to click on the link for the assignment in your LMS (Canvas or Edx) -- that will take you to gitHub classroom, where you can accept the assignment.
85
+
86
+
When you accept, gitHub will create a new repository for the assignment, in your gitHub account.
87
+
88
+
89
+
Clone the Repo
90
+
--------------
91
+
92
+
Once the repository has been created on gitHUb, you need to make a copy, or "clone" of it on your local workstation, where you will be writing your code.
93
+
94
+
To Clone:
95
+
.........
96
+
97
+
1) Click on the "Code" button:
98
+
99
+
.. image:: images/githubclassroom/code_button.png
100
+
.. :width: 600
101
+
102
+
2) Copy the "https: " url that shows up -- you can click the little clipboard icon to copy -- or highlight and copy the url
103
+
104
+
.. image:: images/githubclassroom/clone_url.png
105
+
.. :width: 600
106
+
107
+
3) Go to your command line in the terminal application (Terminal, git Bash, CMD prompt, etc). Make sure you are "in" the directory that you have set up for this class. ``ls``, ``dir`` and ``pwd`` can be helpful to make sure.
(you should be able to type ``git clone`` and then paste the url you copied from gitHub)
116
+
117
+
This will create a new directory for the repository, named by the assignment and your giHub handle -- this is where you will put all the work for that assignment.
118
+
119
+
5) Start working
120
+
121
+
::
122
+
123
+
cd the_name_of_the_assignment_repo
124
+
125
+
6) Create a new branch for your work and "check it out"
126
+
127
+
::
128
+
129
+
git checkout -b develop
130
+
131
+
After that command, git will be "in" the develop branch -- anything you change will only be reflected in that branch.
132
+
133
+
.. note:: A git "branch" is an independent "part" of a repo where you can write and change code, create and delete files, etc, and it will be kept separate from the main code. When you are happy with this version, it can be merged into the main branch. For the purposed of this course, it will not be merged into the main branch until it has been reviewed, and both you and your instructors think its done.
134
+
135
+
7) Check the git status
136
+
137
+
::
138
+
139
+
$ git status
140
+
On branch develop
141
+
nothing to commit, working tree clean
142
+
143
+
That lets you know that you are on the develop branch, and that you haven't made any changes to your files (the "working tree" is the dir and files on your machine)
144
+
145
+
8) Add some files. Create a new file or files for the assignment with your text editor. Once they are there, it's a good idea to add them before you do much work on them, but you can add them at any time.
146
+
147
+
::
148
+
149
+
git add a_new_file.py
150
+
151
+
You can also add all the files in the directory with::
152
+
153
+
git add .
154
+
155
+
But be careful -- only do that if you really want everything added to git.
156
+
157
+
9) Commit your work. When you have gotten to a good "pause point" in your work -- the first feature works, or you need help from the instructors, etc, you can "commit" the current state of your project. It's a good idea to check the status first.
158
+
159
+
::
160
+
161
+
$ git status
162
+
On branch develop
163
+
Changes to be committed:
164
+
(use "git restore --staged <file>..." to unstage)
165
+
new file: a_simple_script.py
166
+
new file: another_file.py
167
+
new file: install_test.py
168
+
169
+
Changes not staged for commit:
170
+
(use "git add <file>..." to update what will be committed)
171
+
(use "git restore <file>..." to discard changes in working directory)
172
+
modified: install_test.py
173
+
174
+
note that in this case, I edited the ``install_test.py`` file after adding it. When you edit a file, git will not track those changes unless you tell it to, which you can to by calling ``git add`` again. So ``git add`` tells git that you want it to keep track of that file -- called "staging for commit"::
175
+
176
+
$ git add install_test.py
177
+
178
+
$ git status
179
+
On branch develop
180
+
Changes to be committed:
181
+
(use "git restore --staged <file>..." to unstage)
182
+
new file: a_simple_script.py
183
+
new file: another_file.py
184
+
new file: install_test.py
185
+
186
+
Note that after adding the file (again!) it is now ready to be committed::
187
+
188
+
git commit -m "adding the initial files"
189
+
190
+
``-m`` means "message" -- you always need to provide a commit message.
191
+
192
+
There is a trick to save a step -- you can ask git to commit all changes you've made since the last commit::
193
+
194
+
$ git commit -a -m "initial files added"
195
+
196
+
[develop 4985f9d] initial files added
197
+
3 files changed, 17 insertions(+)
198
+
create mode 100644 a_simple_script.py
199
+
create mode 100644 another_file.py
200
+
create mode 100644 install_test.py
201
+
202
+
The ``-a`` means "all". Note that you still need to use ``git add`` to ask git to track a new file that it is not already managing.
203
+
204
+
10) Push the changes to gitHub: All this adding and committing has only affected the repository on your own machine -- gitHub has not been changed. In order to get your changes up to gitHub you need to "push" them. It's always a good idea to check the status before you push -- to make sure you're ready.
205
+
206
+
::
207
+
208
+
$ git status
209
+
On branch develop
210
+
nothing to commit, working tree clean
211
+
212
+
Note that I am on the "develop" branch, which is what's wanted, and nothing new to commit -- all my changes have been committed -- it's time to push.
213
+
214
+
::
215
+
216
+
$ git push
217
+
fatal: The current branch develop has no upstream branch.
218
+
To push the current branch and set the remote as upstream, use
219
+
220
+
git push --set-upstream origin develop
221
+
222
+
Hmm -- "fatal" -- I don't like the look of that! But it's pretty simple, really. git is telling you that it doesn't know where to push the code to -- your gitHub version of the repo doesn't have a develop branch. But it tells you want to do to create that branch on gitHub (origin), so do that:
To https://github.com/UWPCE-Py310-Fall2020/initial-setup-PythonCHB.git
238
+
* [new branch] develop -> develop
239
+
Branch 'develop' set up to track remote branch 'develop' from 'origin'.
240
+
241
+
So good -- now the local develop branch is hooked up to a develop branch on gitHub. And it even tells you what to do next -- see the "Create a pull request for 'develop' on GitHub by visiting:" -- that's exactly what you need to do!
242
+
243
+
11) Make a Pull Request: A Pull Request (PR) is a request to "pull" the code you've just written into another branch -- usually the main branch.
244
+
In "real" development, this means that you have added a feature, or fixed a bug, and want that code to be deployed. But if you are not the primary developer, or if you work on a team, then the code may be need to be reviewed before it's merged into the production branch.
245
+
For this class, we are mimicking that workflow, but it is the instructors that will review your code. When the code has been reviewed, we mill "Merge" the PR into main, indicating that you have completed the assignment.
246
+
247
+
Go to assignment gitHub repo in your browser. It should have a note that you have pushed a develop branch, and a button to click to create a PR:
A "commit" is snapshot of your code (and any other files included in your project).
82
263
You are encouraged to make frequent commits, as this will make it easier for you to restore your code to an earlier state if things go wrong.
@@ -112,7 +293,7 @@ It's a good idea to do that before committing, so you know what will happen.
112
293
113
294
114
295
Pushing Your Code
115
-
=================
296
+
-----------------
116
297
117
298
"Pushing" refers to the process of synchronizing the commits you have made on your development system with your GitHub repository.
118
299
This is an important process, since it is needed before you can submit your code for review.
@@ -130,7 +311,7 @@ Asking Coding Questions
130
311
=======================
131
312
132
313
While working on your code, you might run into a situation in which you would like one of the instructors to look at it and provide some feedback before actually reviewing and grading it.
133
-
In order to do that, go to "Feedback" pull request and write a comment about your question or issue. You should make sure to tag your instructor in your comment, to assure that they are notified of your comment. This is done by writing `@the_instructors_github_handle`, e.g. `@natasha-aleksandrova`.
314
+
In order to do that, go to PR you've created and write a comment about your question or issue. You should make sure to tag your instructor in your comment, to assure that they are notified of your comment. This is done by writing `@the_instructors_github_handle`, e.g. `@natasha-aleksandrova`.
134
315
135
316
For example::
136
317
@@ -140,7 +321,7 @@ When you submit a comment with a tag, the instructor will be notified by GitHub
140
321
141
322
142
323
Submitting your assignment
143
-
==========================
324
+
--------------------------
144
325
145
326
Once your assignment is ready for review, copy the link of your Feedback pull request and submit it in the submission form. Here is an example of a submission link (yours will look a little different but will end with `/pull/1`)::
0 commit comments