Skip to content

Commit f473d36

Browse files
committed
README: Add complete instructions
Add complete instructions for workshop exercises. Signed-off-by: Razvan Deaconescu <razvan@rosedu.org>
1 parent 99648af commit f473d36

1 file changed

Lines changed: 159 additions & 23 deletions

File tree

README.md

Lines changed: 159 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# GitHub Workshop
22

33
This is a practical workshop consisting of common GitHub-related actions.
4+
It is based on the [`unikraft/catalog-core` repository](https://github.com/unikraft/catalog-core), giving us a concrete Git repository to screw up ... hmmmm ... to do wonderful amazing great things to.
45

56
First of all, clone the [repository](https://github.com/rosedu/workshop-github):
67

@@ -62,7 +63,7 @@ Follow the instructions [here](https://docs.github.com/en/authentication/connect
6263

6364
Create a personal access token to use as an authentication mechanism for GitHub.
6465
Follow the instructions [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic).
65-
Add all permissions to the personal access token.
66+
Add **all permissions** to the personal access token.
6667

6768
## Set Up GitHub CLI
6869

@@ -86,45 +87,180 @@ git clone https://github.com/microsoft/openvmm
8687
git clone https://github.com/nodejs/node
8788
```
8889

89-
For each repository, use the GitHub CLi tool to:
90+
For each repository, use the GitHub CLI tool to:
9091

91-
- List repository issues.
92-
- List repository pull requests.
93-
- List repository pull requests whose state is `closed`.
94-
- View details about a pull request.
92+
- List repository issues with `gh issue list`.
93+
- List repository pull requests with `gh pr list`.
94+
- List repository pull requests whose state is `closed` with `gh pr list -s closed`.
95+
- View details about a pull request with `gh pr view <PR_ID>`.
9596

96-
## Work with Pull Requests
97+
## Create Work GitHub Repository
9798

98-
### Review and Merge Pull Requests
99+
Let's first create a work GitHub repository based on the current repository.
100+
We will use it for toying arround, messing it up and fixing it.
99101

100-
Create repository and pull requests automatically.
102+
First, make sure you are in the local directory clone of this repository (`workshop-github`).
103+
Then, create a repository on GitHub from the command line (using GitHub CLI - `gh`):
101104

102-
Review and merge pull requests.
105+
```console
106+
./gh-create-repo.sh
107+
```
108+
109+
Check your repository on GitHub using a web browser.
110+
111+
Your repository is now available as the `upstream` remote.
112+
Check your remotes:
113+
114+
```console
115+
git remote show
116+
git remote show origin
117+
git remote show upstream
118+
```
119+
120+
## Create Pull Requests
121+
122+
Let's now create pull requests on our GitHub repository.
123+
A pull request is created from a series of commits in a branch.
124+
125+
We do the steps:
126+
127+
1. Create a branch for the new pull request:
128+
129+
```console
130+
git checkout -b add-c-bye
131+
```
132+
133+
1. Create the contents of the `c-bye` program:
134+
135+
```console
136+
unzip support/c-bye.zip
137+
```
138+
139+
1. Create commit:
140+
141+
```console
142+
git commit -s -m 'Introduce c-bye program'
143+
```
144+
145+
1. Push commit to the `upstream` remote:
146+
147+
```console
148+
git push upstream add-c-bye
149+
```
150+
151+
1. Create a pull request by clicking on the URL that was printed by the command above.
152+
You will end up having a pull request created in the repository.
153+
The pull request is requesting for a merge to happen from the `add-c-bye` to `main`.
154+
155+
### Do It Yourself
156+
157+
1. Repeat the above steps at least 2 more times.
158+
Reset before each step:
159+
160+
```console
161+
./gh-reset-repo.sh
162+
```
163+
164+
1. Do the same steps as above for the `cpp-bye` and `python3-bye` programs in the `support/` directory.
165+
You should end up with three pull requests.
166+
167+
## Review and Merge Pull Requests
168+
169+
The pull requests should be reviewed and merged.
170+
For that, in the GitHub web interface for the pull request follow the steps:
171+
172+
1. Go to the `Files changed` tab.
173+
174+
1. Click the `Review changes` button.
103175

104-
Reset and repeat.
176+
1. Approve the pull request.
105177

106-
### Create Pull Requests
178+
1. Now, get back to the `Conversation` tab.
179+
See that the pull request is now approved.
180+
Go below to the `Merge pull request` button.
107181

108-
Create commit and branches.
182+
Below clicking the button, see the options from the little dropdown option on the right.
183+
See what are the options, choose one and do it.
109184

110-
Push
185+
### Do It Yourself
111186

112-
Create pull request.
187+
1. Do the steps above for all 3 pull requests.
113188

114-
Review end merge.
189+
1. Now reset the repository:
115190

116-
Reset and repeat.
191+
```console
192+
./gh-reset-repo.sh
193+
```
194+
195+
and redo the pull requests, and merge them again.
196+
197+
1. Create your own commits and pull requests.
198+
Be creative.
199+
200+
Create at least one pull request with two commits.
201+
Use the `Squash and merge` merge strategy.
202+
203+
## Configure Merge Strategy
204+
205+
We want to configure `Rebase and merge` as the only merge strategy.
206+
207+
For that, do the steps:
208+
209+
1. Go in the `Settings` tab in web view of your GitHub repository.
210+
211+
1. Go to the `Pull Requests` session.
212+
213+
1. Uncheck `Allow merge` commits and `Allow squash merging`.
214+
215+
Now create a new pull request and see that the only option for merging is `Rebase and merge`.
117216

118217
## Collaborate with GitHub
119218

120-
Submit PR to a repository of someone else - use a fork.
219+
GitHub shines for collaborative / team work.
220+
For this, work in pairs of two.
221+
222+
Before this, do a reset of your repository:
223+
224+
```
225+
./gh-reset-repo.sh
226+
```
227+
228+
Each of view should now:
229+
230+
1. Create of fork of the other's repository.
231+
Be sure to give it a different name, not to clash with your own `workshop-github` repository name.
232+
233+
1. Clone the fork locally:
234+
235+
```console
236+
git clone <fork_url>
237+
cd <clone_directory>
238+
```
239+
240+
1. Create a branch and commit(s) from `c-bye`.
241+
242+
1. Push the branch to the `origin` remote (belonging to your fork).
243+
244+
1. Create a pull request to the other's repository (from fork to the initial repository).
245+
246+
1. The other person should approve and merge your pull request.
247+
248+
Do this multiple times, be creative, use your own ideas.
121249

122250
## Your Own Repository
123251

124-
Work in pairs.
252+
Now, let's get really creative.
253+
254+
Continue working in pairs of two.
255+
256+
Each of you should create their own repository, with whatever content they want.
257+
Create it from scratch, be creative, do whatever you want.
258+
Configure the repository to use the `Rebase and merge` strategy.
259+
260+
Ask the other to fork your repository and then ask the other to create a pull request.
261+
Toy around.
125262

126-
Create repository, fill all items, tabs.
127-
Create initial commits.
128-
Create issues.
263+
### Nice To Do
129264

130-
Solve issues from others.
265+
Before asking for a pull request, create an issue on your repository, and ask the other to "solve" the issue by creating a corresponding pull request.
266+
Link the pull request to the issue once it is created, by following instructions [here](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue).

0 commit comments

Comments
 (0)