Skip to content

Commit 4e38847

Browse files
committed
upate
1 parent 76b7f04 commit 4e38847

File tree

7 files changed

+244
-120
lines changed

7 files changed

+244
-120
lines changed

challenges/102/05.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Git advanced commands
2+
3+
## What you will learn
4+
5+
- Get a single commit to another branch
6+
- Using git fragments
7+
- Undo _almost_ everything
8+
9+
## 👾 Before we start the exercise
10+
11+
- Check the [`oh-my-zsh` Cheatsheet](https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet)
12+
13+
## 👨‍🚀 Exercise 5.1
14+
15+
- [ ] From `main` create a branch `gcb feature/cherry-pick`
16+
- [ ] Create a slide "How to apply commit"
17+
- [ ] Commmit your work
18+
- [ ] Go to your main branch with `gcm`
19+
- [ ] Use `git cherry-pick YOURSHA1` to get your commit without merging it to `main`
20+
21+
## 👨‍🚀 Exercise 5.2
22+
23+
- [ ] Create a branch with `gcb feature/stash`
24+
- [ ] Create a slide "How to use git fragments"
25+
- [ ] Move your diff between 2 branches using `git stash` and `git stash pop`
26+
- [ ] Commmit your work
27+
28+
## 👨‍🚀 Exercise 5.3 —Undo a “public” change
29+
30+
__Scenario__: You just ran `git push`, sending your changes to GitHub, now you realize there’s a problem with one of those commits. You’d like to undo that commit.
31+
32+
- [ ] Create a new slide "this one will be reverted"
33+
- [ ] Identify the last sha1 with `glol`
34+
- [ ] Use `git revert <SHA1>` to commit your changes
35+
36+
## 👨‍🚀 Exercise 5.4 —Fix the last commit message
37+
38+
__Scenario__: You just typo’d the last commit message, you did `git commit -m "Fxies bug #42"` but before `git push` you realized that really should say `“Fixes bug #42”`.
39+
40+
- [ ] Create a new slide "How to fix the last commit message"
41+
- [ ] Undo with `git commit --amend` or `git commit --amend -m "Fixes bug #42"`
42+
43+
## 👨‍🚀 Exercise 5.5 —Undo “local” changes
44+
45+
__Scenario__: The cat walked across the keyboard and somehow saved the changes, then crashed the editor. You haven’t committed those changes, though. You want to undo everything in that file—just go back to the way it looked in the last commit.
46+
47+
- [ ] Try to reproduce the scenario
48+
- [ ] Cancel your changes with `git checkout -- <bad filename>`
49+
50+
## 👨‍🚀 Exercise 5.6 —Reset “local” changes
51+
52+
__Scenario__: You’ve made some commits locally (not yet pushed), but everything is terrible, you want to undo the last three commits—like they never happened.
53+
54+
- [ ] Try to reproduce the scenario
55+
- [ ] Undo with: `git reset <last good SHA>` or `git reset --hard <last good SHA>`
56+
57+
## 👨‍🚀 Exercise 5.7 —Mass undo/redo
58+
59+
__Scenario__: You started this feature in one direction, but mid-way through, you realized another solution was better. You’ve got a dozen or so commits, but you only want some of them. You’d like the others to just disappear.
60+
61+
- [ ] Create a branch `gcb feature/clean-mess`
62+
- [ ] Create new slide "How to rebase"
63+
- [ ] Commit your work
64+
- [ ] Change the theme
65+
- [ ] Commit your work
66+
- [ ] Update your slide
67+
68+
```markdown
69+
__What’s happening__: `-i` puts rebase in “interactive mode”. It starts off like the rebase discussed above, but before replaying any commits, it pauses and allows you to gently modify each commit as it’s replayed.
70+
```
71+
- [ ] Commit your work
72+
- [ ] Use `git rebase -i <earlier SHA>` and remove the "Changing theme commit" and `fixup` the last commit
73+
74+
## 👽 Bonus —Redo after undo “local”
75+
76+
__Scenario__: You made some commits, did a `git reset --hard` to “undo” those changes (see above), and then realized: you want those changes back!
77+
78+
- [ ] Try to reproduce the scenario
79+
- [ ] Undo with: `git reflog` and `git reset` or `git checkout`
80+
81+
You can recover _almost_ anything—anything you’ve committed—via the reflog.
82+
83+
There is plenty of ways to undo things, feel free to have a look at [the complete list](https://github.com/blog/2019-how-to-undo-almost-anything-with-git).
84+
85+
## 🏅 Elaboration and Feedback
86+
87+
After the exercice, to __remember what you've just learned__, then [fill out the elaboration and feedback form](https://airtable.com/shrBuZqOJL5UeLLF1?prefill_Name=GitHub%20103&prefill_Exercice=01).

challenges/102/06.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Advanced branching
2+
3+
## What you will learn
4+
5+
- Working together on the same branch
6+
7+
## 👨‍🚀 Exercise 2.1
8+
9+
- [ ] Change your push config
10+
11+
```console
12+
git config --global push.default current
13+
```
14+
15+
## 👨‍🚀 Exercise 2.2
16+
17+
- [ ] Clone the repo of your right neighbor
18+
- [ ] Ask him to invite you as a collaborator on Settings / Manage acess
19+
- [ ] Ask him to create a new branch `feature/guest-posting`
20+
- [ ] Ask him to create a slide "Working together on the same branch"
21+
- [ ] Work directly on his branch with `git checkout --track origin/feature/guest-posting`
22+
- [ ] Update the slide "Working together on the same branch" with some content
23+
- [ ] Commit your work and push (You can do multiple commits)
24+
- [ ] Ask him merge your work on his repo
25+
26+
## 👨‍🚀 Exercise 2.3
27+
28+
Now we are going to try to deal with conflicts.
29+
30+
- dev2 create a branch `feature/deal-with-conflicts`
31+
- dev1 should work only on `main`
32+
- dev1 create a slide "How to deal with conflicts"
33+
- dev1 commit
34+
- dev2 create a slide "How to deal with conflicts"
35+
- dev2 commit
36+
37+
---
38+
39+
- dev1 push to `main`
40+
- dev2 checkout to main with `gcm`
41+
- dev2 pull last changes `gup`
42+
- dev2 `gc feature/deal-with-conflicts`
43+
44+
If you followed everything dev2 should have a conflict when using:
45+
46+
```console
47+
git rebase main
48+
```
49+
50+
![](https://user-images.githubusercontent.com/56160171/132004977-527c4602-05eb-4e9d-872a-23ec9647ec70.png)
51+
52+
- [ ] Fix the conflict
53+
- [ ] dev2 save the work with `gaa`
54+
- [ ] continue to rebase the next commit with
55+
56+
```console
57+
git rebase --continue
58+
```
59+
60+
🛰 If you are lost you can cancel your `rebase`
61+
62+
```console
63+
git rebase --abort
64+
```
65+
66+
## 🏅 Elaboration and Feedback
67+
68+
After the exercice, to __remember what you've just learned__, then [fill out the elaboration and feedback form](https://airtable.com/shrBuZqOJL5UeLLF1?prefill_Name=GitHub%20103&prefill_Exercice=02).

challenges/103/01.md

+44-59
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,72 @@
1-
# Git advanced commands
1+
# Create your first GitHub action
22

33
## What you will learn
44

5-
- Get a single commit to another branch
6-
- Using git fragments
7-
- Undo _almost_ everything
5+
- Automate, customize, and execute your software development workflows right in your GitHub repository
86

97
## 👾 Before we start the exercise
108

11-
- Check the [`oh-my-zsh` Cheatsheet](https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet)
9+
- GitHub Actions is a CI/CD (Continuous Integration/Continuous Deployment) solution provided by GitHub.
10+
- You may ask yourself "What is a GitHub action?" [everything is on the `github-actions` documentation](https://help.github.com/en/articles/workflow-syntax-for-github-actions)
1211

1312
## 👨‍🚀 Exercise 1.1
1413

15-
- [ ] From `main` create a branch `gcb feature/cherry-pick`
16-
- [ ] Create a slide "How to apply commit"
17-
- [ ] Commmit your work
18-
- [ ] Go to your main branch with `gcm`
19-
- [ ] Use `git cherry-pick YOURSHA1` to get your commit without merging it to `main`
14+
Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any code project on GitHub.
2015

21-
## 👨‍🚀 Exercise 1.2
22-
23-
- [ ] Create a branch with `gcb feature/stash`
24-
- [ ] Create a slide "How to use git fragments"
25-
- [ ] Move your diff between 2 branches using `git stash` and `git stash pop`
26-
- [ ] Commmit your work
27-
28-
## 👨‍🚀 Exercise 1.3 —Undo a “public” change
29-
30-
__Scenario__: You just ran `git push`, sending your changes to GitHub, now you realize there’s a problem with one of those commits. You’d like to undo that commit.
31-
32-
- [ ] Create a new slide "this one will be reverted"
33-
- [ ] Identify the last sha1 with `glol`
34-
- [ ] Use `git revert <SHA1>` to commit your changes
16+
To create a new workflow:
3517

36-
## 👨‍🚀 Exercise 1.4 —Fix the last commit message
18+
- [ ] Go to your GitHub repository.
19+
- [ ] Click on the Actions tab.
20+
- [ ] Click on set up a workflow yourself if you want to create a custom workflow, or you can choose a template.
3721

38-
__Scenario__: You just typo’d the last commit message, you did `git commit -m "Fxies bug #42"` but before `git push` you realized that really should say `“Fixes bug #42”`.
39-
40-
- [ ] Create a new slide "How to fix the last commit message"
41-
- [ ] Undo with `git commit --amend` or `git commit --amend -m "Fixes bug #42"`
42-
43-
## 👨‍🚀 Exercise 1.5 —Undo “local” changes
22+
## 👨‍🚀 Exercise 1.2
4423

45-
__Scenario__: The cat walked across the keyboard and somehow saved the changes, then crashed the editor. You haven’t committed those changes, though. You want to undo everything in that file—just go back to the way it looked in the last commit.
24+
- [ ] Create a new file `.github/workflows/hello.yml`
4625

47-
- [ ] Try to reproduce the scenario
48-
- [ ] Cancel your changes with `git checkout -- <bad filename>`
26+
```yml
27+
name: CI
4928

50-
## 👨‍🚀 Exercise 1.6 —Reset “local” changes
29+
on: [push, pull_request]
5130

52-
__Scenario__: You’ve made some commits locally (not yet pushed), but everything is terrible, you want to undo the last three commits—like they never happened.
31+
jobs:
32+
build:
33+
runs-on: ubuntu-latest
5334

54-
- [ ] Try to reproduce the scenario
55-
- [ ] Undo with: `git reset <last good SHA>` or `git reset --hard <last good SHA>`
35+
steps:
36+
- uses: actions/checkout@v2
5637

57-
## 👨‍🚀 Exercise 1.7 —Mass undo/redo
38+
- name: Run a one-line script
39+
run: echo Hello, world!
40+
```
5841
59-
__Scenario__: You started this feature in one direction, but mid-way through, you realized another solution was better. You’ve got a dozen or so commits, but you only want some of them. You’d like the others to just disappear.
42+
## 👨‍🚀 Exercise 1.3
6043
61-
- [ ] Create a branch `gcb feature/clean-mess`
62-
- [ ] Create new slide "How to rebase"
63-
- [ ] Commit your work
64-
- [ ] Change the theme
65-
- [ ] Commit your work
66-
- [ ] Update your slide
44+
- [ ] Commit to your repository to launch the action
6745
68-
```markdown
69-
__What’s happening__: `-i` puts rebase in “interactive mode”. It starts off like the rebase discussed above, but before replaying any commits, it pauses and allows you to gently modify each commit as it’s replayed.
70-
```
71-
- [ ] Commit your work
72-
- [ ] Use `git rebase -i <earlier SHA>` and remove the "Changing theme commit" and `fixup` the last commit
46+
## 👨‍🚀 Exercise 1.4
7347
74-
## 👽 Bonus —Redo after undo “local”
48+
You can trigger a GitHub Actions workflow on a specific branch by specifying the branch name in the on section of your workflow file.
7549
76-
__Scenario__: You made some commits, did a `git reset --hard` to “undo” those changes (see above), and then realized: you want those changes back!
50+
- [ ] Create another file `.github/workflows/hello-branch.yml`
7751

78-
- [ ] Try to reproduce the scenario
79-
- [ ] Undo with: `git reflog` and `git reset` or `git checkout`
52+
```yml
53+
name: CI
8054
81-
You can recover _almost_ anything—anything you’ve committed—via the reflog.
55+
on:
56+
push:
57+
branches:
58+
- main # This workflow will only run when changes are pushed to the 'main' branch
59+
pull_request:
60+
branches:
61+
- main # This workflow will also run when pull requests are opened to the 'main' branch
8262
83-
There is plenty of ways to undo things, feel free to have a look at [the complete list](https://github.com/blog/2019-how-to-undo-almost-anything-with-git).
63+
jobs:
64+
build:
65+
runs-on: ubuntu-latest
8466
85-
## 🏅 Elaboration and Feedback
67+
steps:
68+
- uses: actions/checkout@v2
8669
87-
After the exercice, to __remember what you've just learned__, then [fill out the elaboration and feedback form](https://airtable.com/shrBuZqOJL5UeLLF1?prefill_Name=GitHub%20103&prefill_Exercice=01).
70+
- name: Run a one-line script
71+
run: echo Hello, world!
72+
```

challenges/103/02.md

+38-53
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,53 @@
1-
# Advanced branching
1+
# GitHub actions events
22

33
## What you will learn
44

5-
- Working together on the same branch
5+
- ...
66

7-
## 👨‍🚀 Exercise 2.1
7+
## 👾 Before we start the exercise
88

9-
- [ ] Change your push config
9+
- Here is the list of [GitHub actions events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)
1010

11-
```console
12-
git config --global push.default current
13-
```
14-
15-
## 👨‍🚀 Exercise 2.2
16-
17-
- [ ] Clone the repo of your right neighbor
18-
- [ ] Ask him to invite you as a collaborator on Settings / Manage acess
19-
- [ ] Ask him to create a new branch `feature/guest-posting`
20-
- [ ] Ask him to create a slide "Working together on the same branch"
21-
- [ ] Work directly on his branch with `git checkout --track origin/feature/guest-posting`
22-
- [ ] Update the slide "Working together on the same branch" with some content
23-
- [ ] Commit your work and push (You can do multiple commits)
24-
- [ ] Ask him merge your work on his repo
25-
26-
## 👨‍🚀 Exercise 2.3
27-
28-
Now we are going to try to deal with conflicts.
29-
30-
- dev2 create a branch `feature/deal-with-conflicts`
31-
- dev1 should work only on `main`
32-
- dev1 create a slide "How to deal with conflicts"
33-
- dev1 commit
34-
- dev2 create a slide "How to deal with conflicts"
35-
- dev2 commit
11+
## 👨‍🚀 Exercise 1
3612

37-
---
13+
- [ ] Create a Push Event
3814

39-
- dev1 push to `main`
40-
- dev2 checkout to main with `gcm`
41-
- dev2 pull last changes `gup`
42-
- dev2 `gc feature/deal-with-conflicts`
15+
```yml
16+
name: CI on Push
17+
on:
18+
push:
19+
branches:
20+
- main
4321

44-
If you followed everything dev2 should have a conflict when using:
45-
46-
```console
47-
git rebase main
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v2
28+
- name: Run a one-line script
29+
run: echo Hello, Push Event!
4830
```
4931
50-
![](https://user-images.githubusercontent.com/56160171/132004977-527c4602-05eb-4e9d-872a-23ec9647ec70.png)
51-
52-
- [ ] Fix the conflict
53-
- [ ] dev2 save the work with `gaa`
54-
- [ ] continue to rebase the next commit with
32+
- [ ] Commit to your repository to launch the action
5533
56-
```console
57-
git rebase --continue
58-
```
34+
## 👨‍🚀 Exercise 2
5935
60-
🛰 If you are lost you can cancel your `rebase`
61-
62-
```console
63-
git rebase --abort
64-
```
36+
- [ ] Create a Pull Request Event
6537
66-
## 🏅 Elaboration and Feedback
38+
```yml
39+
name: CI on Pull Request
40+
on:
41+
pull_request:
42+
branches:
43+
- master
6744

68-
After the exercice, to __remember what you've just learned__, then [fill out the elaboration and feedback form](https://airtable.com/shrBuZqOJL5UeLLF1?prefill_Name=GitHub%20103&prefill_Exercice=02).
45+
jobs:
46+
test:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v2
51+
- name: Run a one-line script
52+
run: echo Hello, Pull Request Event!
53+
```

0 commit comments

Comments
 (0)