This lesson plan is intended for the "old style" presential classes. If using the flipped classroom method, the contents would be about the same, but the class itself should focus on exercises. Suggested exercises for the flipped classroom can be found here.
In any of the cases, the goal of the class is for the students to be able to use git/github to collaborate in the final project.
-
Why branches?
-
The 3 types of branches:
- the local non-tracking branches
- the local tracking branches
- the remote tracking branches
-
Push/Pull branches to github
-
Create a merge conflict and show how to solve it (use vscode to select which changes to keep).
-
Do an exercise (to basically repeat what was shown before with the slides and all):
- create repo
class_example
, both locally and on github - in master, create file
fruits.txt
, add the names of 3 fruits, one per line, Commit your changes. - push
master
to github - from
master
, create branchfeature/fruits
, modify the name of the second fruit and add two new fruits at the end of the file (one per line) - on github, on branch
master
, change the name of the second fruit in the filefruits.txt
- update your local branch
feature/fruits
with the contents ofmaster
- push
feature/fruits
to github - create pull request to merge
feature/fruits
intomaster
- create repo
-
Git diff and git stash:
- show the git diff when we make changes in current feature
- explain git stash
- show git diff (when there are no differences)
- explain git stash list and then git stash apply
- explain difference between git stash apply and git stash pop
- show some more options like git diff --stat
-
How to "remove" commits
- git reset soft vs. hard
- git revert
- git cherry-pick
- git rebase -i HEAD~N
-
Exercise to create commit use reset soft, and then create another commit use reset hard.
-
Show git checkout to a specific commit.
-
Random things that should be mentioned throughout the class:
- git checkout -- / git restore (only works in git 2.23+)
- git reset HEAD / git restore --staged (only works in git 2.23+)
- git rm --cached
- git commit --amend
- show how to check that local branch is up to date with origin (with git log)
-
How to write a good commit message.
-
How to create a good, easy to understand PR.
- Review - contains a short review over the materials taught in class;
- Class exercises - contains a short review over the materials taught in class;
- Cheatsheet - contains a cheatsheet with the commands used during the class (and a few extra);
- Resources - contains some resources about Git that might be useful;
- Git Advance - the slides used to teach some concepts during class.