diff --git a/lectures/revealjs/04-git-demo.adoc b/lectures/revealjs/04-git-demo.adoc new file mode 100644 index 0000000000000000000000000000000000000000..569ef0d4747bf20f594e64de7dd9553b9aa9b4db --- /dev/null +++ b/lectures/revealjs/04-git-demo.adoc @@ -0,0 +1,100 @@ += SCM - Git demo +:customcss: slides.css +:icons: font +:includedir: revealjs/includes/ +:LECTURE_TOPIC: Git demo +:LECTURE_NO: 4th lecture + +include::{includedir}header.adoc[] + + +[.smaller-80][.center-paragraph] +IT1901 Fall 2020 - {LECTURE_NO} + +[background-color = "#124990"] +[color = "#fff6d5"] +== Git demo + +== Installing and setting up git + +- Go to https://git-scm.com/downloads +- Download and install the right version for your OS +- git commands are now available + +[.grid-left-right-50-50] +== Typical sequence (share project) + +[.area-left] +- starting a project and sharing it on Gitlab for team collaboration +** `git init` +** `git status` + +[.area-right] +** `git add ...` +** `git commit ...` +** `git remote ...` +** `git push` + +== Commit messages + +image::../images/git_commit_2x.png[size=75%] +[.smaller-40] +https://xkcd.com/1296/ + +== Commit messages (seriously) + +- Separate subject from body with a blank line +- Limit the subject line to 50 characters +- Capitalize the subject line +- Do not end the subject line with a period +- Use the imperative mood in the subject line +- Wrap the body at 72 characters +- Use the body to explain what and why vs. how + + + +[.grid-left-right-50-50] +== Typical sequence (simple collaboration) + +[.area-left] +- working with a shared project +** `git clone` +** `git pull` + +[.area-right] +** `git status` +** `git add ...` +** `git commit ...` +** `git push` + +== Conflicts (1) + +** when same files (lines) are changed by different devs +** automatic merge is not possible +** we need to solve that to be able to push our changes + +== Conflicts (2) - Setup + +- `git config merge.tool vimdiff` +- `git config merge.conflictstyle diff3` +- `git config mergetool.prompt false` + +== Conflicts (3) - Solving + +- `git mergetool` +- `:wqa` save and exit from vi +- `git commit -m "message"` +- `git clean` remove file (might remove other untracked files) + + +== Typical sequence (with branching) + +- working with branches +** `git pull` +** `git checkout -b <branch_name>` +** `git status` + `git add ...` + `git commit ...` +** `git checkout master` +** `git merge <branch_name>` + + +include::{includedir}footer.adoc[] \ No newline at end of file diff --git a/lectures/revealjs/images/git_commit_2x.png b/lectures/revealjs/images/git_commit_2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4b3e6a451f0942f5ee89988b9b5e962deddf8daf Binary files /dev/null and b/lectures/revealjs/images/git_commit_2x.png differ