Skip to content

Commit 3464d7a

Browse files
authored
Add section on issues to git lesson (#97)
* Clarify syntax for entering user information * Update text and formatting * Add section on issues to example workflow * Link to better docs page for issues * Minus one dash * Add issues entry to summary table
1 parent ec0b241 commit 3464d7a

File tree

2 files changed

+80
-40
lines changed

2 files changed

+80
-40
lines changed

lessons/git/git-workflow.md

Lines changed: 73 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ how to use version control on an individual or a group project.
88
Imagine, for instance,
99
backing up and tracking your thesis,
1010
or collaborating on writing a journal article
11-
with a colleague.
11+
with a colleague,
12+
or contributing to a Python library someone else has written.
1213

1314
We'll broadly follow the series of actions in this workflow:
1415

16+
* issue
1517
* fork
1618
* clone
1719
* status
@@ -30,24 +32,57 @@ and we'll frequently refer to this diagram of git remotes:
3032
![git remotes](https://raw.githubusercontent.com/csdms/ivy/main/lessons/git/media/git-remotes-diagram.png "Git remotes")
3133

3234

35+
## Issue
36+
37+
Say you're working with a Python library and you find a bug.
38+
How can you communicate this problem to the library's author?
39+
If the library is hosted on GitHub,
40+
this is where an *issue* is used.
41+
With an issue,
42+
you can report a bug,
43+
request a feature,
44+
or just ask a question about a repository.
45+
Issues are the primary way to communicate with a repository owner on GitHub.
46+
47+
An issue includes a title, a body,
48+
and, optionally, a comment thread.
49+
The title should be brief, yet descriptive.
50+
The body is used to describe the issue;
51+
it can written in [Markdown](https://docs.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax),
52+
a simple markup language.
53+
In the body,
54+
you can also `@` other GitHub users (e.g., `@mcflugen`)
55+
to include them on the issue.
56+
The comment thread is used to discuss the issue.
57+
GitHub provides [much more information](https://docs.github.com/en/issues/tracking-your-work-with-issues)
58+
on writing issues.
59+
60+
Let's use the repository https://github.com/csdms/ivy-collaboration as an example.
61+
62+
1. Click the link above to go to the repository page on GitHub.
63+
1. From the top left of the repository page, select the *Issues* button to create a new issue.
64+
65+
In the new issue,
66+
request to be added as a contributor to the `ivy-collaboration` repository.
67+
Create a title and add appropriate language to the body of the issue to make your request.
68+
3369
## Fork
3470

35-
We'll start by forking a repository on GitHub.
36-
A *fork* is a copy of a repository, a *remote*, placed under your GitHub account.
71+
After creating an issue,
72+
we can propose a change to the example repository.
73+
74+
Start this process with a *fork*--a copy of a repository, a *remote*, placed under your GitHub account.
3775
Forks are used for repositories where you don't have write access
3876
(meaning you can view files, but not change them).
3977
Note that forking is a GitHub, not a `git`, concept.
4078

41-
Let's use the repository https://github.com/csdms/ivy-collaboration as an example.
42-
43-
1. Go to the [repository page](https://github.com/csdms/ivy-collaboration) on GitHub.
44-
1. From the top right of the repository page, select the *Fork* button--you'll
45-
be asked where to create the fork; select your GitHub account.
79+
From the top right of https://github.com/csdms/ivy-collaboration,
80+
select the *Fork* button--you'll be asked where to create the fork; select your GitHub account.
4681

4782
After the fork is created,
4883
the path to the repository on GitHub will read
49-
**[username]/ivy-collaboration** instead of **csdms/ivy-collaboration**,
50-
where **[username]** is your GitHub username,
84+
`[username]/ivy-collaboration` instead of `csdms/ivy-collaboration`,
85+
where `[username]` is your GitHub username,
5186
indicating your ownership of this copy of the repository.
5287

5388

@@ -61,9 +96,9 @@ As the name suggests,
6196
a cloned repository is an identical, but separate,
6297
copy of the current state of the original.
6398

64-
On your computer, open a terminal and change to your **Desktop** directory:
99+
On your computer, open a terminal and change to your home directory:
65100
```
66-
$ cd ~/Desktop
101+
$ cd
67102
```
68103
Note that this is a convenience; you can do the following steps anywhere on the filesystem.
69104

@@ -73,14 +108,12 @@ The syntax for the `git clone` subcommand is
73108
$ git clone [repository-url]
74109
```
75110
where the bracketed text should be replaced with the SSH URL of your new repository.
76-
You'll be prompted to enter the password for your SSH key.
111+
You'll be prompted to enter the passphrase for your SSH key.
77112

78-
The repository is cloned into the directory **ivy-collaboration**.
113+
The repository is cloned into the directory `ivy-collaboration`.
79114
Change to it and view its contents:
80115
```
81116
$ cd ivy-collaboration
82-
$ pwd
83-
/Users/mpiper/Desktop/ivy-collaboration
84117
$ ls
85118
CONTRIBUTORS.md LICENSE README.md
86119
```
@@ -155,7 +188,7 @@ use the `git checkout` subcommand
155188
$ git checkout mdpiper/update-contributors
156189
Switched to branch 'mdpiper/update-contributors
157190
```
158-
You can verify that the new branch is current with `git branch`.
191+
You can verify that the new branch is current with `git branch` or `git status`.
159192

160193

161194
## Edit
@@ -164,16 +197,16 @@ Adding or editing content is typically where most of your time is spent
164197
in a project.
165198
In this example, however, it'll be trivial.
166199

167-
Recall that the **ivy-collaboration** repository
168-
has a file, **CONTRIBUTORS.md**.
200+
Recall that the `ivy-collaboration` repository
201+
has a file, `CONTRIBUTORS.md`.
169202
View the files in the repository:
170203
```
171204
$ ls
172205
CONTRIBUTORS.md LICENSE README.md
173206
```
174207
With your favorite text editor,
175-
open **CONTRIBUTORS.md**
176-
add your name to the list of contributors,
208+
open `CONTRIBUTORS.md`
209+
and add your name to the list of contributors,
177210
along with something interesting
178211
(but not too interesting--this is a public repository).
179212
Save the file.
@@ -245,8 +278,8 @@ to stage a subset of related changes to be grouped into a single commit.
245278
To finalize the changes to the repository,
246279
we *commit* them with `git commit`:
247280
```
248-
$ git commit -m "Add an interesting fact to contributor list"
249-
[mdpiper/update-contributors 4c9565b] Add an interesting fact to contributor list
281+
$ git commit -m "Add member to contributor list"
282+
[mdpiper/update-contributors 4c9565b] Add member to contributor list
250283
1 file changed, 1 insertion(+), 1 deletion(-)
251284
```
252285

@@ -317,7 +350,7 @@ remote:
317350
To https://github.com/mdpiper/ivy-collaboration
318351
* [new branch] mdpiper/update-contributors -> mdpiper/update-contributors
319352
```
320-
You'll again be prompted to enter the password for your SSH key.
353+
You'll again be prompted to enter the passphrase for your SSH key.
321354

322355
Note that the output from `git push`
323356
includes a link to create a *pull request* on GitHub.
@@ -327,22 +360,21 @@ and we'll create a pull request next.
327360

328361
## Pull request
329362

330-
A *pull request* is a GitHub feature
331-
that allows you to argue why the changes that you've pushed to a remote
363+
A *pull request* allows you to argue why the changes that you've pushed to a remote
332364
deserve to be merged into that repository.
333365
In a pull request,
334366
you have to make a case to the owner of the repository
335367
that your code improves on theirs.
336368

337-
A pull request includes a title, a body,
369+
Like an issue,
370+
a pull request includes a title, a body,
338371
and, optionally, a comment thread.
339372
The title should be brief, yet descriptive,
340373
and written as an imperative.
341-
The body is used to explain your changes
374+
The body,
375+
written in [Markdown](https://docs.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax),
376+
is used to explain your changes
342377
and to argue for their inclusion in the repository.
343-
To help make the text more descriptive,
344-
the body is written in [Markdown](https://docs.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax),
345-
a simple markup language.
346378
In the body,
347379
you can also `@` other GitHub users (e.g., `@BCampforts`)
348380
to include them on the pull request.
@@ -351,7 +383,7 @@ The comment thread is used to discuss the merits of the pull request.
351383
GitHub provides [much more information](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
352384
on pull requests.
353385

354-
Argue well, and your contribution may be accepted by the repository owner!
386+
Argue well and your contribution may be accepted by the repository owner!
355387

356388

357389
## Merge
@@ -375,8 +407,9 @@ the *upstream* remote includes history not present in the *local* or *origin* re
375407
We can *sync* these repositories in a few steps.
376408

377409
First,
378-
use the `git remote` subcommand to view what remotes are being tracked on your local machine:
410+
use the `git remote` subcommand to view what remotes are being tracked by your local repository:
379411
```
412+
$ git remote -v
380413
origin [email protected]:mdpiper/ivy-collaboration.git (fetch)
381414
origin [email protected]:mdpiper/ivy-collaboration.git (push)
382415
```
@@ -418,6 +451,10 @@ Finally, sync the *origin* remote by pushing the changes from your local reposit
418451
$ git push origin main
419452
```
420453

454+
All three repositories,
455+
*local*, *origin*, and *upstream*,
456+
now contain the same information.
457+
421458

422459
## Summary
423460

@@ -428,7 +465,8 @@ For example,
428465
all CSDMS products are open source.
429466
If you find a problem in our software, documentation,
430467
Jupyter Notebooks, etc.,
431-
please fix it and send us pull request!
468+
please create an issue,
469+
or just fix it and send us pull request!
432470
You'll get credit for your contribution.
433471

434472

@@ -437,6 +475,7 @@ This table summarizes `git` and GitHub concepts covered in this section:
437475
| Concept | Description
438476
| ------------ | -----------
439477
| repository | a storage area for files where history is tracked by version control
478+
| issue | a tool for tracking work on GitHub
440479
| fork | a repository copied from elsewhere on GitHub that exists under your GitHub account
441480
| branch | a pointer to a timeline of commits to a repository
442481
| current branch | the active repository branch accepting changes

lessons/git/github-authentication.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ proceed to the next section.
4545
To create a new SSH key,
4646
type the following into a terminal:
4747
```
48-
$ ssh-keygen -t ed25519 -C "[your email address]"
48+
$ ssh-keygen -t ed25519 -C "YOUR EMAIL"
4949
```
5050
The `-t` flag specifies the type of key to create;
5151
in this case,
5252
using the [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) algorithm.
53-
Use the email address associated with your GitHub account.
54-
Follow the prompts and enter a password.
53+
Use the email address associated with your GitHub account,
54+
keeping the quote marks.
55+
Follow the prompts and enter a passphrase for the key.
5556

5657
Check the contents of your **.ssh** directory (which will now exist if it didn't before):
5758
```
@@ -60,7 +61,7 @@ id_ed25519 id_ed25519.pub
6061
```
6162
You now have an SSH key pair (private, public).
6263

63-
Remember your password!
64+
Remember your passphrase!
6465
You'll have to enter it when connecting to GitHub.
6566
Optionally,
6667
you can use the `ssh-agent` service on your computer to store the password;
@@ -93,11 +94,11 @@ That's it!
9394

9495
## Test your SSH key
9596

96-
To check that GitHub has your SSH key, type the following in terminal:
97+
To check that GitHub has your SSH key, type the following in a terminal:
9798
```
9899
99100
```
100-
You'll be prompted to enter the password for your key.
101+
You'll be prompted to enter the passphrase for your key.
101102

102103
If you get a return like
103104
```

0 commit comments

Comments
 (0)