Skip to content
Snippets Groups Projects
Commit 67f5ba04 authored by George Adrian Stoica's avatar George Adrian Stoica
Browse files

Prepare slides for the 4th lecture

Supporting slides for the git demo lecture
parent bffc302f
No related branches found
No related tags found
No related merge requests found
= 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
lectures/revealjs/images/git_commit_2x.png

112 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment