Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • sc/edu/git-seminar
  • mk21womu/git-seminar
2 results
Select Git revision
Show changes
Commits on Source (112)
Showing with 740 additions and 792 deletions
...@@ -2,5 +2,15 @@ img/git-remote-contributor.svg ...@@ -2,5 +2,15 @@ img/git-remote-contributor.svg
img/git-remote-maintainer.svg img/git-remote-maintainer.svg
img/git-remote-solo.svg img/git-remote-solo.svg
img/license-chooser.svg img/license-chooser.svg
img/motivation-structure.svg
img/motivation-throwaway-playground.svg img/motivation-throwaway-playground.svg
img/rdm-use-case-data.svg
img/rdm-use-cases-a.svg
img/rdm-use-cases-b.svg
img/rdm-use-cases.svg
img/staging-area.svg img/staging-area.svg
paper.html
paper.pdf
*.pdf
img/staging-area-diff.svg
/img/rdm-use-case-merged.svg
[submodule "reveal.js"] [submodule "reveal.js"]
path = reveal.js path = reveal.js
url = https://github.com/hakimel/reveal.js.git url = https://github.com/hakimel/reveal.js.git
[submodule "pandoc-cheat-sheet"]
path = pandoc-cheat-sheet
url = https://github.com/idiv-biodiversity/pandoc-cheat-sheet.git
# Introduction to git - a powerful version control system
## block structure
- Why git?
- poll from registration
- other points from our list
- git installation hands on
- git on the command line
- navigate manipulate on cli
- ls, pwd, cd, mv, rm, cp, mkdir, rmdir
- short break (optional)
- (like) try git on beamer (closed laptops)
- try git would be 1.1 to 1.9
- init
- status
- add
- commit
- log (metadata only)
- short break (optional)
- hands on - created project
- multiple commits
- multiple files
- diff
- log (with patch)
- wrap up hands on
- problems that occurred
- conclusion
## Why git?
### Why would you want to use a VCS, e.g. git?
- Summary of answers to question from registration.
- git helps you to keep an overview of a project.
### Thoughts from the net “Have you ever:”
- Made a change to code, realised it was a mistake and wanted to revert back?
- Lost code or had a backup that was too old?
- Had to maintain multiple versions of a product?
- Wanted to see the difference between two (or more) versions of your code?
- Wanted to prove that a particular change broke or fixed a piece of code?
- Wanted to review the history of some code?
- Wanted to submit a change to someone else's code?
- Wanted to share your code, or let other people work on your code?
- Wanted to see how much work is being done, and where, when and by whom?
- Wanted to experiment with a new feature without interfering with working code?
In these cases, and no doubt others, a version control system should make your life easier.
To misquote a friend: A civilised tool for a civilised age.
by si618 at [https://stackoverflow.com/a/1408464](https://stackoverflow.com/a/1408464)
## git installation hands on
[instructions](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
### installation on ubuntu
We will use the version from the git ppa:
```bash
sudo apt-get install ppa-purge
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install git
```
### installation on windows
- [Download](https://git-scm.com/download/win)
- choose 64 bit
- portable if you do not have admin rights
- default install options look OK
- Git Bash
- Windows Explorer context menue has *Git Bash Here* and *Git GUI Here* options
- Windows credential window will pop up when accessing remotes with authentication
### navigate and manipulate on cli
- pwd
- ls
- cd
- mv
- rm
- cp
- mkdir
- rmdir
### configure git
```bash
git config --global user.name "Your Name"
git config --global user.email "your.name@idiv.de"
```
- eventually additionally configuration for windows/linux/mac stuff
- line break configuration done during install for windows
- eventually mention difference global local
## short break (optional)
## show try git like tutorial on beamer (closed laptops)
- try git would be 1.1 to 1.9
- create project directory
- init
- status
- add
- commit
- log (metadata only)
## short break (optional)
## hands on - created project
- multiple commits
- multiple files
- diff
- log (with patch)
- test this with a windows and mac machine to see things like editor, linebreaks, etc.
## wrap up hands on
- problems that occurred
- conclusion
...@@ -4,12 +4,35 @@ SUBDIRS = \ ...@@ -4,12 +4,35 @@ SUBDIRS = \
$(SUBDIRS): $(SUBDIRS):
$(MAKE) -C $@ $(MAKE) -C $@
pandoc-papers.pdf: pandoc-papers.md
pandoc \
-V aspectratio=169 \
-V institute=iDiv \
-V theme=Frankfurt \
-V navigation=horizontal \
-V logo=img/idiv-black-logo.png \
--pdf-engine=xelatex \
-s \
-t beamer \
-o pandoc-papers.pdf \
pandoc-papers.md
rdm.pdf: img rdm.md rdm.yml
pandoc \
--standalone \
--from=markdown+yaml_metadata_block \
--pdf-engine=xelatex \
--template=pandoc-cheat-sheet/cheat-sheet.tex \
-o rdm.pdf \
rdm.yml rdm.md
all: subdirs all: subdirs
clean: clean:
for dir in $(SUBDIRS); do \ for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \ $(MAKE) -C $$dir $@; \
done done
rm -f rdm.pdf
default: all default: all
......
# The Official iDiv git Seminar # The Official iDiv git Seminars
## Usage ## Usage
- update reveal.js submodule To view the presentations locally, you need to clone the repository
- run make to create svg from dot sources recursively, to also get a copy of [reveal.js][]:
```bash
git clone --recursive https://git.idiv.de/sc/edu/git-seminar.git
```
Then you also need to create the images from the [graphviz dot
sources][graphviz]:
```bash
cd git-seminar
make
```
Then you can view the presentations, e.g. the basics:
```
firefox basics.html
```
## Attribution ## Attribution
- git logo by [Jason Long](https://twitter.com/jasonlong) - git logo by [Jason Long](https://twitter.com/jasonlong)
[graphviz]: http://www.graphviz.org/
[reveal.js]: https://revealjs.com/#/
# regular FAQ
- 10-12 git integration RStudio / VS Code / others
- 13-15 GitLab / GitHub project setup / importing existing projects / how to start and continue after that, project management, issue management
- 15-16 GitLab / GitHub automation
- 16-18 free for all
# git advanced -- how to maintain a comprehensible history
- when projects get bigger
- show bad example with merge commits
- show git-flow being harmful
- show git-pretty
Advanced git is not about edge use cases, it's all about keeping your history
comprehensible, i.e. understandable.
## trunk based development
- project history, e.g. via `gitk` or `git lol`, should resemble a **tree**
- for this section we're sticking to the tree metaphor
- long-lived branches basically **master** (and **releases**)
- long trunk of tree
- dead branches on lower trunk (old, unmaintained releases), which may also be
cut down in time if support is dropped
- only clean merges (could have been ff)
## final chapter
- consider like backup slides
- show goodies
## resources
- https://barro.github.io/2016/02/a-succesful-git-branching-model-considered-harmful/
- https://stackoverflow.com/questions/14023648/why-does-my-git-history-look-like-a-christmas-tree
- https://i.stack.imgur.com/ZsXT6.png
- https://trunkbaseddevelopment.com
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="author" content="Dirk Sarpe and Christian Krause" />
<title>git basics</title> <title>git basics</title>
<meta name="description" content="a git seminar for beginners" />
<meta name="author" content="Dirk Sarpe and Christian Krause" />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="reveal.js/css/reveal.css" />
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css" /> <link rel="stylesheet" href="reveal.js/dist/reset.css">
<style type="text/css">code{white-space: pre;}</style> <link rel="stylesheet" href="reveal.js/dist/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme" /> <link rel="stylesheet" href="reveal.js/dist/theme/black.css" id="theme">
<link rel="stylesheet" href="reveal.js/plugin/highlight/monokai.css">
<link rel="stylesheet" href="css/company-logo.css" /> <link rel="stylesheet" href="css/company-logo.css" />
<link rel="stylesheet" href="css/ribbon.css" /> <link rel="stylesheet" href="css/ribbon.css" />
<link rel="stylesheet" href="css/crawl.css" />
</head> </head>
<body> <body>
...@@ -29,26 +37,57 @@ ...@@ -29,26 +37,57 @@
## for beginner-level git users ## for beginner-level git users
notes: notes:
- close your laptops - `make -B` to create images
- hand out cheat sheets later, no need to write stuff down - two terminals each with same tmux session, increase font size
- `export LANG=en_US.UTF-8`
- `export PS1="\\[\\033[0;36m\\]\\w\\[\\033[0;35m\\]\$(__git_ps1 \" (%s)\")\\[\\033[0;36m\\] $ \\[\\033[0m\\]"`
- remove git config for demo
- log in to git.idiv.de
- cheat sheets are handed out later
- if you have questions feel free to interrupt - if you have questions feel free to interrupt
- cleanup https://git.idiv.de/sc/edu/git-merge-conflict-demo
</section>
<section id="intro-goals" data-markdown>
## goals
1. use git in **ALL** your projects
1. collaborate with each other
... is mission accomplished.
notes:
- there is time for fancy stuff later
- take a few weeks getting used to git
- delay is good to grow your own experience
- growing pain is how we learn
</section> </section>
<section id="intro-objectives" data-markdown> <section id="intro-agenda-1" data-markdown>
## objectives ## agenda (today)
- teach you to fish 1. motivation
- hands-on experience 1. install and setup
- use version control! 1. recording changes
- collaborate! 1. platforms and remotes
1. collaboration
note:
- we have dynamic breaks, try at most 90 minutes without break
</section> </section>
<section id="intro-agenda" data-markdown> <section id="intro-agenda-2" data-markdown>
## agenda ## agenda (advanced)
1. customization (editors, IDEs)
1. project & team setup (GitLab)
1. how to project maintainer
1. automation
1. intro and installation note:
1. setup and local repositories - in smaller groups
1. remote repositories and collaboration - while today is more general, advanced will be focused on your
specific situation
</section> </section>
<section id="intro-version-control" data-markdown> <section id="intro-version-control" data-markdown>
...@@ -57,6 +96,11 @@ ...@@ -57,6 +96,11 @@
> records changes > records changes
what, who, when, why what, who, when, why
note:
- different kinds of version control systems
- for different meta-level things
- git is for text files / source code
</section> </section>
<section id="intro-about-git" data-markdown> <section id="intro-about-git" data-markdown>
...@@ -76,27 +120,10 @@ ...@@ -76,27 +120,10 @@
- doc: also means community / stackoverflow entries - doc: also means community / stackoverflow entries
</section> </section>
<section id="intro-about-today" data-markdown>
## about today
be able to ...
1. use git in **ALL** your projects
2. collaborate with each other
... is mission accomplished.
notes:
- there is time for fancy stuff later
- take a few weeks getting used to git
- delay is good to grow your own experience
- growing pain is how we learn
</section>
<section id="intro-about-christian" data-markdown> <section id="intro-about-christian" data-markdown>
## about christian ## about christian
- scientific computing support @ iDiv since 2014 - [scientific computing support @ iDiv](https://www.idiv.de/en/about-idiv/support-for-scientists/scientific-computing.html) since 2014
- happy git user since 2010 - happy git user since 2010
> There will never be a better version control system than git. > There will never be a better version control system than git.
...@@ -104,15 +131,6 @@ ...@@ -104,15 +131,6 @@
> -- Christian Krause, 2017 > -- Christian Krause, 2017
</section> </section>
<section id="intro-about-dirk" data-markdown>
## about dirk
- statistics and R support @ iDiv since 2014
- knows that kind of pain:
![blah](img/draft_mess_half_size.png)
</section>
<section id="intro-about-you" data-markdown> <section id="intro-about-you" data-markdown>
## about you ## about you
...@@ -121,8 +139,7 @@ ...@@ -121,8 +139,7 @@
name, job, git experience, why git? name, job, git experience, why git?
notes: notes:
- re-seat everyone so that experienced user sits together with - re-seat everyone based on command line experience
inexperienced user
</section> </section>
</section> </section>
...@@ -134,14 +151,20 @@ ...@@ -134,14 +151,20 @@
<section id="motivation" data-markdown> <section id="motivation" data-markdown>
# motivation # motivation
> Why should I use git? > Why should ***I*** use version control?
notes:
- summarize reasons from audience
- highlight that motivation chapter is more about the concept of
version control in general, not git specifically, because git is
just a tool to do it
</section> </section>
<section id="motivation-avoid-mess" data-markdown> <section id="motivation-avoid-mess" data-markdown>
## motivation #1 ## motivation #1
### avoid mess ### avoid mess
![blah](img/draft_mess.png) ![blah](img/motivation-draft-mess.png)
notes: notes:
- who has seen such a mess? - who has seen such a mess?
...@@ -153,12 +176,13 @@ ...@@ -153,12 +176,13 @@
## motivation #1 ## motivation #1
### want structure ### want structure
![blah](img/gitk-pretty-history.png) ![blah](img/motivation-structure.svg)
notes: notes:
- TODO better repo with more contributors
- structure - structure
- who, when, why - who, when, why
- ability to inspect old versions
- ability to revert to old versions
</section> </section>
<section id="motivation-playground" data-markdown> <section id="motivation-playground" data-markdown>
...@@ -171,36 +195,19 @@ ...@@ -171,36 +195,19 @@
- test stuff without interfering - test stuff without interfering
- throw away if garbage - throw away if garbage
- integrate if good - integrate if good
- switch back and forth - switch back and forth without pain
- (done right) decision based on regression testing
</section> </section>
<section id="motivation-collaboration-1" data-markdown> <section id="motivation-collaboration-1" data-markdown>
## motivation #3 ## motivation #3
![boy scout rule](img/boy-scout-rule.jpg)
notes:
- there's a rule in ~~open source software~~ nay life
- if you want the world to be a better place
- complain about it (issue tracker)
- if you are able to fix it: do it!
</section>
<section id="motivation-collaboration-2" data-markdown>
## motivation #3
### collaboration made easy ### collaboration made easy
<!-- do not fix this typo, it's here on purpose to show collab --> <!-- do not fix this typo, it is here on purpose to show collab -->
> This text cuntains a typo. > This text cntains a typo.
notes: notes:
- demo GitLab - demo **edit** ribbon
- [go to project](https://git.idiv.de/sc/edu/git-seminar) - change target branch (creates MR) to: **basics/typo**
- check if typo still in master
- edit
- change **target branch** to create merge request
- commit message: - commit message:
``` ```
fixes typo fixes typo
...@@ -209,60 +216,76 @@ ...@@ -209,60 +216,76 @@
``` ```
</section> </section>
<section id="motivation-creative-use" data-markdown> <section id="motivation-collaboration-2" data-markdown>
## motivation #4 ## motivation #3
### the creative use of git award
#### goes to Michael Schilli
```yml
videos:
- id: '_3i5yVoTvCs'
title: 'How to flip German pancakes'
- id: 'brPfE66FC24'
title: 'Tivo Stream Cooling Fan Replacement'
```
```console
$ youtube-sync -i videos.yml
_3i5yVoTvCs: Unchanged
brPfE66FC24: Updated OK
```
source: [Linux Magazin](http://www.linux-magazin.de/) 2018/01
</section>
<section id="motivation-use-everywhere" data-markdown>
## motivation #e
### use version control for
# *everything*
| common | less frequent | esoteric? | ![typo-pr](https://pbs.twimg.com/media/EDsklbLUEAMdusJ.png)
| ------------ |:---------------:| ---------------:|
| software | presentation | youtube |
| blog / doc | paper / thesis | soundboard |
| user config | task management | drinking games |
notes: notes:
- software, thats obvious - might not seem like much
- blog / doc: web-pages in general are more and more managed by git - but you are still making the world a better place
- e.g. this git cheat sheet we're handing out is a git repo - and it is not too much effort
- if it doesn't support git don't use it
</section> </section>
<section id="motivation-automation" data-markdown> <section id="motivation-automation" data-markdown>
## motivation #a ## motivation #a
### automation ### automation
- software testing - ***quality assurance***
- code quality - **static code analysis** aka *linting*
- deploy to app store - **testing** (unit, integration, regression)
- deploy presentation on web server - enforce **style guide** aka *code formatting*
- ***deployment*** (app store, web server)
*(see advanced seminar)* *(see advanced)*
notes: notes:
- buzzwords:
- continuous integration (CI)
- continuous deployment (CD)
- pre-commit hooks
- basically, everything you can script - basically, everything you can script
</section> </section>
<section class="star-wars" id="motivation-wars">
<div class="crawl">
<div class="title">
<h1>motivation #wars</h1>
</div>
<div data-markdown>
1. revert a bad change?
1. view the history?
1. know why someone changed it?
1. maintain multiple versions?
1. see the diff of two versions?
1. find commit that broke something?
1. have free backup?
1. have non-interfering playgrounds?
1. have automated testing?
1. have automated deployment?
1. forget about ms word comments?
1. contribute to a project?
1. share your code?
1. let other people do the work for you?
</div>
<img src="http://i.giphy.com/90F8aUepslB84.gif" />
</div>
</section>
</section> </section>
<!--------------------------------------------------------------------- <!---------------------------------------------------------------------
...@@ -274,42 +297,52 @@ ...@@ -274,42 +297,52 @@
# install # install
</section> </section>
<section id="setup-os-packages" data-markdown> <section id="setup-cli" data-markdown>
## command line
![just take the damn red pill](img/matrix-pill.jpg)
notes:
- learn by doing / understand what you do
- GUI hides too much of that
- use GUI only if it integrates well in your workflow, e.g. IDE
- my main editor is emacs, so I am using emacs integration (magit)
for most of my day-to-day tasks, only a few key presses per git
operation, when I am in the terminal, I simply use the CLI
</section>
<section id="install-os-packages" data-markdown>
## os packages ## os packages
- **Linux:** `bash` and `git` - **Linux:** `bash` and `git`
- **Mac:** `bash` and `git` - **Mac:** `bash` and `git`
- **Windows 10+:** `WSL` - **Windows:** [git bash](https://git-scm.com/download/win)
- **Windows < 10:** `cmder`
notes: notes:
- [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) - **Windows Subsystem for Linux (WSL)**: we do not use it because
- who needs install? others can go instant break it cannot use native Windows editors
- **cmder**: we have tried it, it sucks
</section> </section>
</section>
<section id="break-1" data-markdown> <section id="install-your-turn" data-markdown>
# break ## os packages
### your turn
1. install git CLI
1. open terminal
1. type: `git version`
notes: notes:
- keep break short, only for installation - we **need** git 2.23 for `git switch` and `git restore`
- hand out cheat sheets </section>
</section> </section>
<section> <section>
<section id="setup" data-markdown> <section id="setup" data-markdown>
# setup # setup
</section>
<section id="setup-cli" data-markdown>
## command line
![staging area](img/matrix-pill.jpg)
notes: notes:
- learn by doing / understand what you do - add **break** here if needed
- gui hides too much of that
- use gui if gui helps workflow
</section> </section>
<section id="cli-description" data-markdown> <section id="cli-description" data-markdown>
...@@ -329,6 +362,42 @@ ...@@ -329,6 +362,42 @@
# optional argument # optional argument
git diff [--staged] git diff [--staged]
``` ```
notes:
- do not yet type along, we will tell you
- do not type brackets they just mean argument optional
</section>
<section id="cli-bash-basics" data-markdown>
## command line
### bash basics
```bash
pwd # print working directory
ls [dir] # list directory contents
echo msg # print message
cd [dir] # change directory
mkdir dir # create directory
rmdir dir # remove directory
rm file # remove file
cp src dest # copy from source to destination
mv src dest # move / rename
```
```bash
nano file # edit file (Linux / Mac)
notepad file # edit file (Windows)
```
notes:
- go through commands then everyone open terminal
- create a directory
- create README
- rename directory
- copy README to README.md
- use autocompletion with tab
- use bash history with cursor and ctrl+r
- explain `.` and `..`
</section> </section>
<section id="cli-git" data-markdown> <section id="cli-git" data-markdown>
...@@ -344,28 +413,61 @@ ...@@ -344,28 +413,61 @@
``` ```
</section> </section>
<section id="setup-git" data-markdown> <section id="cheat-sheet" data-markdown>
## git setup ## cheat sheet
https://idiv-biodiversity.github.io/git-cheat-sheet/
</section>
<section id="setup-git-1" data-markdown>
## git setup #1
```bash ```bash
# configure your identity # configure your identity
git config --global user.name 'Jane Doe' git config --global user.name "Jane Doe"
git config --global user.email 'jane.doe@riot-grrrl.org' git config --global user.email "jane.doe@idiv.de"
# show colors # show colors
git config --global color.ui auto git config --global color.ui auto
# editor
git config --global core.editor emacs
# configure aliases # configure aliases
git config --global alias.unstage 'reset HEAD --' git config --global alias.unstage "reset HEAD --"
git config --global alias.lol \ git config --global alias.lol \
'log --graph --decorate --oneline --all' "log --graph --decorate --oneline --all"
# show config
git config --list [--global]
``` ```
notes: notes:
- editor: talk about line endings - hand out cheat sheets **now**
- for Windows: check that `core.autocrlf true`, but do not waste
time explaining it for everyone
</section>
<section id="setup-git-2" data-markdown>
## git setup #2
```bash
# Windows
git config --global core.editor notepad
# Mac
git config --global core.editor "open -Wne"
# Linux GNOME / KDE
git config --global core.editor gedit
git config --global core.editor kate
# to verify editor works
git config --global --edit
```
notes:
- if you already have another *core* editor for yourself, feel free
to use it
- if not, please stick to a simple-to-use one for the duration of
the seminar
</section> </section>
</section> </section>
...@@ -377,6 +479,10 @@ ...@@ -377,6 +479,10 @@
<section id="cli-basic" data-markdown> <section id="cli-basic" data-markdown>
# git command line # git command line
## local repositories ## local repositories
notes:
- add **break** here if needed
- this section has demo and interactive part
</section> </section>
<section id="cli-create-repository" data-markdown> <section id="cli-create-repository" data-markdown>
...@@ -394,15 +500,30 @@ ...@@ -394,15 +500,30 @@
``` ```
notes: notes:
- this is an explanation slide
- for this tutorial we are creating a new repository - for this tutorial we are creating a new repository
- mkdir ~/projects - at home you can `init` your existing projects *without* version
- git init hello
- README.md
- src/hello.lang
- for #homework you init your existing projects *without* version
control control
</section> </section>
<section id="cli-create-repository-your-turn" data-markdown>
## create a repository
### your turn
1. create a project called **hello**
1. write a short `README` file
notes:
- mention cheat sheet
- switch to terminal after a while and demo solution
```bash
mkdir ~/projects
git init hello
cd hello
$EDITOR README.md
```
</section>
<section id="cli-git-status" data-markdown> <section id="cli-git-status" data-markdown>
## command line ## command line
### git status ### git status
...@@ -416,23 +537,26 @@ ...@@ -416,23 +537,26 @@
- important git command - important git command
- shows a lot of information - shows a lot of information
- shows basic git commands - shows basic git commands
- later, we'll see different outputs - later, we will see different outputs
</section> </section>
<section id="internals-staging-area" data-markdown> <section id="internals-staging-area" data-markdown>
## internals ## the staging area
### the staging area
![staging area](img/staging-area.svg) ![staging area](img/staging-area.svg)
notes: notes:
- can I have your attention, please? - **do not demo here! that is done during next slide, this one is
- content can be in three stages about the concept of the staging area**
- we make changes, these are not yet known to git - **call for attention, this is important**
- we prepare a commit by **successively** adding changes to the - in a local git repository, content can be in three stages
staging area - make local changes, these are **not yet** known to git
- we commit this **set of changes** - **prepare** commit adding more and more **changes**
- a commit **should be a logical unit** of changes - **commit** this **set of changes**
- commit **should be a logical unit** of changes
- the deciding feature of a git (G)UI is how it handles the stage,
i.e. if you cannot interactively stage/unstage hunks, the UI
sucks
</section> </section>
<section id="cli-git-files" data-markdown> <section id="cli-git-files" data-markdown>
...@@ -445,7 +569,7 @@ ...@@ -445,7 +569,7 @@
git unstage file git unstage file
# discard changes # discard changes
git checkout file git restore file
# rename and remove # rename and remove
git mv source destination git mv source destination
...@@ -453,23 +577,21 @@ ...@@ -453,23 +577,21 @@
``` ```
notes: notes:
- git stage git add are the same thing - users should do this in a terminal with demo by us
- prefer stage and unstage because the opposite of add is remove - `git stage` and `git add` are the same thing
and that does something entirely different - prefer `stage` and `unstage` because the opposite of `add` is
`rm` and that does something entirely different
</section> </section>
<section id="cli-git-diff-1" data-markdown> <section id="cli-git-diff" data-markdown>
## command line ## command line
### show changes ### show changes
```bash ![git diff](img/staging-area-diff.svg)
# from staging area to current working copy
git diff
# show contents of staging area, i.e. notes:
# from last commit to staging area - users should do this in a terminal with demo by us
git diff --staged - make a round and check
```
</section> </section>
<section id="cli-git-commit" data-markdown> <section id="cli-git-commit" data-markdown>
...@@ -481,8 +603,11 @@ ...@@ -481,8 +603,11 @@
git commit [-v] git commit [-v]
# commits with a short message # commits with a short message
git commit -m 'initial commit' git commit -m "initial commit"
``` ```
notes:
- users execute commit after next two explanation slides
</section> </section>
<section id="commit-messages-xkcd" data-markdown> <section id="commit-messages-xkcd" data-markdown>
...@@ -492,7 +617,7 @@ ...@@ -492,7 +617,7 @@
</section> </section>
<section id="commit-messages-example" data-markdown> <section id="commit-messages-example" data-markdown>
## commit messages conventions ## commit message conventions
```markdown ```markdown
this is a short subject line this is a short subject line
...@@ -501,11 +626,12 @@ ...@@ -501,11 +626,12 @@
and to the point. The body may explain in more detail why and to the point. The body may explain in more detail why
this change was introduced. this change was introduced.
- don't list which files changed - do not list which files changed
- the diff already tells that - the diff already tells that
References to issue trackers should be in the very end, References to issue trackers should be in the very end, e.g.:
e.g.: fixes #42
fixes #42
``` ```
notes: notes:
...@@ -514,6 +640,7 @@ ...@@ -514,6 +640,7 @@
- wrap 72 characters - wrap 72 characters
- remember: commit = logical unit - remember: commit = logical unit
- the diff tells you what changed, describe why it changed - the diff tells you what changed, describe why it changed
- decide with your team, write `CONTRIBUTING.md`
</section> </section>
<section id="cli-git-log" data-markdown> <section id="cli-git-log" data-markdown>
...@@ -532,22 +659,29 @@ ...@@ -532,22 +659,29 @@
# - one per line # - one per line
git lol git lol
``` ```
notes:
- make a round and check
</section> </section>
<section id="summary-1" data-markdown> <section id="summary-1" data-markdown>
## you can now ## you can now
- track changes in your projects - create local repos (`init`)
- browse your projects history - track changes in your projects (`stage`, `commit`)
- show when and why which changes were made - browse your projects history (`log`)
- rest are helpers (`status`, `diff`, `restore`)
notes:
- very important: `status`
- demo emacs git integration to show `stage -p`
</section> </section>
<section id="summary-2" data-markdown> <section id="summary-2" data-markdown>
## you can now ## goals
> use git in **ALL** your projects 1. use git in **ALL** your projects ✓
> 2. collaborate with each other
> -- goal 1 finished ✓
</section> </section>
</section> </section>
...@@ -561,6 +695,8 @@ ...@@ -561,6 +695,8 @@
## aka legal shit ## aka legal shit
notes: notes:
- non interactive section
- add **break** here if needed
- unfortunately, we have to talk about this - unfortunately, we have to talk about this
- go back to initial commit - go back to initial commit
- initial commit should contain not just readme but license, too - initial commit should contain not just readme but license, too
...@@ -577,6 +713,9 @@ ...@@ -577,6 +713,9 @@
## software licenses ## software licenses
![software licenses](img/license-chooser.svg) ![software licenses](img/license-chooser.svg)
notes:
- there are closed source licenses as well, ask your legal department about those
</section> </section>
<section id="licenses-other" data-markdown> <section id="licenses-other" data-markdown>
...@@ -593,10 +732,6 @@ ...@@ -593,10 +732,6 @@
</section> </section>
</section> </section>
<section id="break-2" data-markdown>
# break
</section>
<!--------------------------------------------------------------------- <!---------------------------------------------------------------------
<!-- distributed <!-- distributed
<!--------------------------------------------------------------------> <!-------------------------------------------------------------------->
...@@ -605,6 +740,9 @@ ...@@ -605,6 +740,9 @@
<section id="distributed" data-markdown> <section id="distributed" data-markdown>
# distributed # distributed
## version control system ## version control system
notes:
- add **break** here if needed
</section> </section>
<section id="distributed-local" data-markdown> <section id="distributed-local" data-markdown>
...@@ -618,18 +756,9 @@ ...@@ -618,18 +756,9 @@
notes: notes:
- collaboration needs remote repositories - collaboration needs remote repositories
- by-product of remotes is backup: my `~/projects` does not need to - by-product of remotes is backup
be backed up because **every** project is under version control - ideally, `~/projects` needs no backup because **every** project
and has a remote is under version control and has a remote
</section>
<section id="distributed-remotes" data-markdown>
## remotes
![remotes](img/git-remote-solo.svg)
notes:
- remotes have names, default to origin
</section> </section>
<section id="distributed-webapps" data-markdown> <section id="distributed-webapps" data-markdown>
...@@ -644,6 +773,40 @@ ...@@ -644,6 +773,40 @@
- create project - create project
- push / pull - push / pull
</section> </section>
<section id="distributed-remotes" data-markdown>
## connecting remotes
```bash
# get fresh clone
git clone url
# add remote to existing repository
git remote add name url
```
note:
- show both commands in web interface when creating new repository
- explain HTTPS and SSH URLs
- for seminar, we will stick to HTTPS
- you can set up password manager integration later, git integrates
well with the common ones
</section>
<section id="distributed-remote-interaction" data-markdown>
## remote
### interaction
![remotes](img/git-remote-solo.svg)
notes:
- remotes have names, default to **origin**
- remotes are usually **full clones**, i.e. entire history, all
commits, all branches
- **fetch** edge is on the box, so you fetch **everything**
- **fetch** does not integrate branches, i.e. no **merge**
- **push** and **pull** also **merge** the *tracking* branch
</section>
</section> </section>
<!--------------------------------------------------------------------- <!---------------------------------------------------------------------
...@@ -655,11 +818,43 @@ ...@@ -655,11 +818,43 @@
# branch and merge # branch and merge
notes: notes:
- what was this **master** again? - this is a demo chapter, you will all do this in collaboration
chapter (next one)
- what was this **main** again? we have not explained yet
</section> </section>
<section id="branches" data-markdown> <section id="branch-visual" data-markdown>
## branches ## branches visualized
![playground](img/motivation-throwaway-playground.svg)
notes:
- we can take a lot away from this small example
- create a branch to have a separate history
- branch is a name attached to a commit
- the name advances when a new commit is made
- **main** is a naming convention for the default branch
- switch back and forth
- always imagine git history as a directed graph
- graph is drawn with new top and old bottom
- commit points to its parent
- git commands modify the graph
</section>
<section id="branch-when-to-use" data-markdown>
## when to use branches
- breaking **main**
- something takes longer
- frequent interruptions
- (instead of) comment out code
notes:
- if logical commit without breaking do not branch
</section>
<section id="branch-commands" data-markdown>
## branch commands
```bash ```bash
# show your local branches # show your local branches
...@@ -672,25 +867,48 @@ ...@@ -672,25 +867,48 @@
git branch name git branch name
# switch to a branch # switch to a branch
git checkout name git switch name
``` ```
notes: notes:
- use wip/feature as branch name, see motivation playground ```
- use git lol frequently to showcase its importance # branch, branch --all
- make changes in playground git lol # show branches
- git push # branch wip/feature, lol
- make changes in master # switch wip/feature, lol
- git lol # edit, commit, lol
- make changes in playground # push, lol
```
- always `lol` because visual representation helps understanding
</section>
<section id="branch-names" data-markdown>
## branch naming
### conventions
```bash
# slashes for categories
hotfix/42
release/1.6.0
# dashes in names
wip/font-changes
# nesting is allowed
topic/ui/input-form
```
notes:
- `git branch --list "topic/*"`
- decide with your team, write `CONTRIBUTING.md`
</section> </section>
<section id="merging" data-markdown> <section id="branch-merging" data-markdown>
## resolving branches ## resolving branches
```bash ```bash
# resolve branch by merging # resolve branch by merging
git checkout master git switch main
git merge branch-name git merge branch-name
# delete branch # delete branch
...@@ -698,7 +916,11 @@ ...@@ -698,7 +916,11 @@
``` ```
notes: notes:
- use git lol to show final layout ```
# switch main, lol
# merge wip/feature, lol
# branch -d wip/feature, lol
```
</section> </section>
</section> </section>
...@@ -711,6 +933,7 @@ ...@@ -711,6 +933,7 @@
# collaboration # collaboration
notes: notes:
- add **break** here if needed
- we: create new repo - we: create new repo
- group: fork and clone, remote add upstream, lol - group: fork and clone, remote add upstream, lol
- next slide, explain img - next slide, explain img
...@@ -723,91 +946,96 @@ ...@@ -723,91 +946,96 @@
notes: notes:
- we: new commit - we: new commit
- group: fetch, lol, pull upstream master, lol - group: fetch, lol, pull upstream main, lol
- group: push origin, lol - group: push origin, lol
- group: commit, push, MR (master or wip?) - group: branch, switch, commit, push, MR
- collaboration happens in issues and MR discussion! - collaboration happens in issues and MR discussion!
- we: review and possible resolve merge request in GL - we: review and possible resolve merge request in GL
- show next slide once merging is done on command line - show next slide once merging is done on command line
</section>
<section id="collab-maintainer" data-markdown>
## view of maintainer
![remotes](img/git-remote-maintainer.svg)
notes:
- we: review one MR, show line comments in GL, thumbs up - we: review one MR, show line comments in GL, thumbs up
- advanced: view of maintainer
</section> </section>
<section id="collab-review" data-markdown> <section id="collab-review-criticism" data-markdown>
## review ## criticism / commenting
code of conduct: - **positive**: leave a star, blog about it
- **negative/destructive**: keep it to yourself!
- **constructive**: issues and merge requests!
- check if already reported
- emote if you agree
- discuss if you disagree
- be friendly notes:
- be responsible - issues / requests are supposed to be technical
- be open - avoid **#metwo**, this is annoying for maintainers, use emotes
- be creative - rule: comment only if you have something new to add to the
- be proactive discussion
- have fun
</section> </section>
<section id="collab-conflicts" data-markdown> <section id="collab-conflicts-contributor" data-markdown>
## resolving conflicts ## resolving conflicts
### maintainer
```bash
git remote add alice https://...
git fetch alice
git checkout master
git merge alice/topic/feature
# fix conflicts
git push
```
### contributor
```bash ```bash
git fetch upstream git fetch upstream
git checkout topic/feature git switch topic/feature
git merge origin/master git merge origin/main
# fix conflicts # fix conflicts
git push git push
``` ```
notes: notes:
- hopefully conflicting changes - https://git.idiv.de/sc/edu/git-merge-conflict-demo
- MR status should show that (can not be merged without conflicts) - contains two conflicting branches
- maintainer decides if trivial or delegate to contributor - git lol
- git fetch
- explain different solutions
- create MR
- MR status show merge conflicts
- edit file, show how to keep both ours and theirs
</section>
<section id="summary-3" data-markdown>
## you can now
- create and connect to remotes (`clone`, `push/pull`)
- contribute to projects (`switch -c`, `push -u origin`, MR/PR)
- hint: use `lol` alias
</section>
<section id="summary-4" data-markdown>
## goals
1. use git in **ALL** your projects ✓
2. collaborate with each other ✓
</section> </section>
</section> </section>
<section> <section>
<section id="homework" data-markdown> <section id="homework" data-markdown>
# homework # "homework"
</section> </section>
<section id="homework-use-git" data-markdown> <section id="homework-use-git" data-markdown>
## homework #1 ## "homework" #1
### use git ### use git
for each project you use ... for each project you use ...
... create repository in GitLab ... ... create repository in GitLab ...
... and commit changes! ... commit and push changes!
notes: notes:
- you will have problems - you will have problems
- because we only taught the basics - because we only taught the basics
- use documentation or ask us - use documentation or ask us
- the advanced seminar will be about some of the techniques - the advanced seminar will be about some of the techniques
- TODO visualize these notes with angler vs fat deep sea fishing net - TODO visualize these notes with fisherman vs deep sea fishing
</section> </section>
<section id="homework-collaborate" data-markdown> <section id="homework-collaborate" data-markdown>
## homework #2 ## "homework" #2
### collaborate ### collaborate
- talk with your colleagues - talk with your colleagues
...@@ -815,9 +1043,34 @@ ...@@ -815,9 +1043,34 @@
- open issues for problems and features - open issues for problems and features
- contribute via merge requests - contribute via merge requests
- review commits and merge requests - review commits and merge requests
- ask others to review your contributions
</section>
<section id="homework-feedback" data-markdown>
## "homework" #3
### feedback
https://git.idiv.de/sc/edu/git-seminar
notes:
- remember code of conduct, criticism and commenting rules
</section> </section>
</section> </section>
<section id="intro-agenda-2" data-markdown>
## agenda advanced
1. customization (editors, IDEs)
1. project & team setup (GitLab)
1. how to project maintainer
1. automation
note:
- in smaller groups
- while today is more general, advanced will be focused on your
specific situation
</section>
<section id="eof" data-background="img/trex.png"> <section id="eof" data-background="img/trex.png">
<h1>EOF</h1> <h1>EOF</h1>
</section> </section>
...@@ -827,31 +1080,71 @@ ...@@ -827,31 +1080,71 @@
# backup slides # backup slides
</section> </section>
<section id="collab-conflicts-rebase" data-markdown> <section id="collab-rebase-maintainer" data-markdown>
## rebasing ## rebasing
### maintainer ### as maintainer
```bash ```bash
git remote add alice https://... git remote add alice https://...
git fetch alice git fetch alice
git rebase master alice/topic/feature git rebase [--interactive] main alice/topic/feature
# fix conflicts # fix conflicts
git push git push
# close merge request # manually close merge request
``` ```
### contributor notes:
- manually close merge request because no merge commit
</section>
<section id="collab-rebase-contributor" data-markdown>
## rebasing
### as contributor
```bash ```bash
git fetch upstream git fetch upstream
git rebase origin/master topic/feature git rebase origin/main topic/feature
# fix conflicts # fix conflicts
# force push because branch history changed # force push because branch history changed
git push --force git push --force
``` ```
</section>
<section id="collab-maintainer" data-markdown>
## view of maintainer
![remotes](img/git-remote-maintainer.svg)
</section>
<section id="collab-review-code-of-conduct" data-markdown>
## review
### code of conduct
1. be friendly
1. be responsible
1. be open
1. be proactive
notes: notes:
- manually close merge request because no merge commit - the discussions are usually public, so be aware of that
- usually needed when community grows
- decide with your community, write `CONTRIBUTING.md`
</section>
<section id="collab-conflicts-maintainer" data-markdown>
## resolving conflicts
```bash
git remote add alice https://...
git fetch alice
git switch main
git merge alice/topic/feature
# fix conflicts
git push
```
notes:
- maintainer decides if trivial or delegate to contributor
</section> </section>
</section> </section>
</div> </div>
...@@ -869,7 +1162,8 @@ ...@@ -869,7 +1162,8 @@
<div class="ribbon-wrapper right"> <div class="ribbon-wrapper right">
<div class="ribbon"> <div class="ribbon">
<a href="https://git.idiv.de/sc/edu/git-seminar"> <a href="https://git.idiv.de/sc/edu/git-seminar/edit/main/basics.html"
target="_blank">
edit edit
</a> </a>
</div> </div>
...@@ -877,30 +1171,28 @@ ...@@ -877,30 +1171,28 @@
<!-- reveal.stuff --> <!-- reveal.stuff -->
<script src="reveal.js/lib/js/head.min.js"></script> <script src="reveal.js/dist/reveal.js"></script>
<script src="reveal.js/js/reveal.js"></script>
<script src="reveal.js/plugin/zoom/zoom.js"></script>
<script src="reveal.js/plugin/notes/notes.js"></script>
<script src="reveal.js/plugin/search/search.js"></script>
<script src="reveal.js/plugin/markdown/markdown.js"></script>
<script src="reveal.js/plugin/highlight/highlight.js"></script>
<script> <script>
Reveal.initialize({ Reveal.initialize({
controls: true, controls: true,
progress: true, progress: true,
slideNumber: true, center: true,
history: true, hash: true,
center: true,
keyboard: true, plugins: [
maxScale: 1.5, RevealZoom,
slideNumber: false, RevealNotes,
theme: Reveal.getQueryHash().theme, RevealSearch,
transition: Reveal.getQueryHash().transition || 'default', RevealMarkdown,
RevealHighlight,
dependencies: [ ]
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
]
}); });
</script> </script>
</body> </body>
......
.star-wars {
height: 800px;
perspective: 400px;
color: #feda4a;
letter-spacing: 6px;
}
.crawl {
position: relative;
animation: crawl 120s linear;
}
.crawl > .title > h1 {
color: #feda4a;
}
@keyframes crawl {
0% {
top: 0;
transform: rotateX(20deg) translateZ(0);
}
100% {
top: -6000px;
transform: rotateX(25deg) translateZ(-2500px);
}
}
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="30,18.6171"/> <dia:point val="30,18.6161"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
<dia:point val="33,15"/> <dia:point val="33,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="32.8075,14.2525;33.1925,15"/> <dia:rectangle val="32.8075,14.255;33.1925,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="33,14.8475"/> <dia:point val="33,14.8491"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
<dia:point val="38,15"/> <dia:point val="38,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="37.8075,14.2525;38.1925,15"/> <dia:rectangle val="37.8075,14.255;38.1925,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="38,14.8475"/> <dia:point val="38,14.8491"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
...@@ -290,7 +290,7 @@ ...@@ -290,7 +290,7 @@
<dia:point val="33,5"/> <dia:point val="33,5"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="30.8137,4.38631;35.2049,6.78988"/> <dia:rectangle val="30.8137,4.40594;35.1863,6.75094"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
...@@ -343,7 +343,7 @@ git rebase b c#</dia:string> ...@@ -343,7 +343,7 @@ git rebase b c#</dia:string>
<dia:point val="28,11"/> <dia:point val="28,11"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="27.8075,10.2525;28.1925,11"/> <dia:rectangle val="27.8075,10.255;28.1925,11"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
...@@ -357,7 +357,7 @@ git rebase b c#</dia:string> ...@@ -357,7 +357,7 @@ git rebase b c#</dia:string>
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="28,10.8475"/> <dia:point val="28,10.8491"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
...@@ -408,7 +408,7 @@ git rebase b c#</dia:string> ...@@ -408,7 +408,7 @@ git rebase b c#</dia:string>
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="51,12.195"/> <dia:point val="51,12.1941"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
...@@ -502,7 +502,7 @@ git rebase b c#</dia:string> ...@@ -502,7 +502,7 @@ git rebase b c#</dia:string>
<dia:point val="56,15"/> <dia:point val="56,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="55.8075,14.2525;56.1925,15"/> <dia:rectangle val="55.8075,14.255;56.1925,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
...@@ -516,7 +516,7 @@ git rebase b c#</dia:string> ...@@ -516,7 +516,7 @@ git rebase b c#</dia:string>
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="56,14.8475"/> <dia:point val="56,14.8491"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
...@@ -535,7 +535,7 @@ git rebase b c#</dia:string> ...@@ -535,7 +535,7 @@ git rebase b c#</dia:string>
<dia:point val="61,15"/> <dia:point val="61,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="60.8075,14.2525;61.1925,15"/> <dia:rectangle val="60.8075,14.255;61.1925,15"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
...@@ -549,7 +549,7 @@ git rebase b c#</dia:string> ...@@ -549,7 +549,7 @@ git rebase b c#</dia:string>
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="61,14.8475"/> <dia:point val="61,14.8491"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
...@@ -598,14 +598,14 @@ git rebase b c#</dia:string> ...@@ -598,14 +598,14 @@ git rebase b c#</dia:string>
<dia:point val="56,5"/> <dia:point val="56,5"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="52.9162,4.38631;59.1024,7.58988"/> <dia:rectangle val="52.9175,4.38731;59.1011,7.58819"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
<dia:attribute name="string"> <dia:attribute name="string">
<dia:string>#cherry-pick <dia:string>#cherry-pick
git checkout b git switch b
git cherry-pick a...c#</dia:string> git cherry-pick a...c#</dia:string>
</dia:attribute> </dia:attribute>
<dia:attribute name="font"> <dia:attribute name="font">
...@@ -652,7 +652,7 @@ git cherry-pick a...c#</dia:string> ...@@ -652,7 +652,7 @@ git cherry-pick a...c#</dia:string>
<dia:point val="51,11"/> <dia:point val="51,11"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="obj_bb"> <dia:attribute name="obj_bb">
<dia:rectangle val="50.8075,10.2525;51.1925,11"/> <dia:rectangle val="50.8075,10.255;51.1925,11"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="text"> <dia:attribute name="text">
<dia:composite type="text"> <dia:composite type="text">
...@@ -666,7 +666,7 @@ git cherry-pick a...c#</dia:string> ...@@ -666,7 +666,7 @@ git cherry-pick a...c#</dia:string>
<dia:real val="0.80000000000000004"/> <dia:real val="0.80000000000000004"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="pos"> <dia:attribute name="pos">
<dia:point val="51,10.8475"/> <dia:point val="51,10.8491"/>
</dia:attribute> </dia:attribute>
<dia:attribute name="color"> <dia:attribute name="color">
<dia:color val="#000000"/> <dia:color val="#000000"/>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="Christian Krause" />
<meta name="dcterms.date" content="2015-06-15" />
<title>Git Workshop</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="reveal.js/css/reveal.css"/>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme" />
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'reveal.js/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--[if lt IE 9]>
<script src="reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1 class="title">Git Workshop</h1>
<h3 class="author">Dirk Sarpe & Christian Krause</h3>
<aside class="notes">
<ul>
<li>if you have questions ask them right away</li>
</ul>
</aside>
</section>
<section id="poll-why-are-you-here" class="titleslide slide level1" data-markdown>
## Poll
# Why are you here?
Note:
- Someone (like us) told you it ~~might be~~ **is** useful.
- You never took the time to really learn it.
- You already know and use it, want to show off / learn new tricks.
- Somebody forced you to come here.
- You wanted to get away from your desk for once and maybe take a nap.
</section>
<section id="outline" class="titleslide slide level1" data-markdown>
# Outline
1. Intro
2. Git Commands
3. GitLab / GitHub
4. Workflows
Note:
- jeder Block ~ 1.5h
- insgesamt 2h mit Pause
- 8h - ein ganzer Tag git
- ein-satz-beschreibungen zu den abschnitten
- 0. why vcs, why git, getting started with git
- 1. git basics
- 2. web collaboration tools
- 3. how to collaborate in organized manner
</section>
<section>
<section class="titleslide slide level1" data-markdown>
## Block 1
# Introduction
Note:
- quickly talk about block outline
- why vcs? why git?
- installation git client
- setup GitLab / GitHub accounts
- getting started with git (try git)
</section>
<section class="slide level2" data-markdown>
### Have you ever seen this?
![foo](img/draft_mess.png)
Note:
- Dirk erklärt seine mess
- wouldn't it be nicer to have
</section>
<section class="slide level2" data-markdown>
### wouldn't it be nicer to have
# version control
```
Dirk Sarpe 14 minutes ago fix reference
Dirk Sarpe 5 days ago adapt figures to nature
Christian Krause 6 days ago add figure captions
Dirk Sarpe 7 weeks ago adds mean values to analysis
Christian Krause 7 weeks ago adds abstract
```
Note:
- git log --pretty=format'%an %ar %s'
- and as you can see not only for source code
</section>
<section class="slide level2" data-markdown>
## have you ever ...
- review history (see diff)
- wanted to go back in time
- maintain multiple versions
- hint: for different journals
- try things out without breaking what works
Note:
-
</section>
<section class="slide level2" data-markdown>
## have you ever ...
- collaborate
- who made that error
- see project progress
- lost code (no backup)
Note:
-
</section>
<section class="slide level2" data-markdown>
# yes?
Note:
-
</section>
<section class="slide level2" data-markdown>
# use vcs!
Note:
-
</section>
</section>
<section>
<section class="titleslide slide level1" data-markdown>
## Block 1
# git
Note:
-
</section>
<section class="titleslide slide level1" data-markdown>
![git](img/what-is-git.jpg)
Note:
-
</section>
<section class="titleslide slide level1" data-markdown>
![git](img/what-is-git-answer.jpg)
Note:
-
</section>
<section class="titleslide slide level1" data-markdown>
![git](img/say-what.jpg)
Note:
-
</section>
<section class="titleslide slide level1" data-markdown>
## what is git? (2nd try)
### seriously
# TODO image gitk all, visual representation of git parent child tree with remotes,
tags, good commit messages, etc. mit local change der remote noch nicht da ist
Note:
- am bild dvcs erklären!
</section>
<section class="slide level2" data-markdown>
![git](img/idontalwaysusevcs.jpg)
Note:
-
</section>
<section class="slide level2" data-markdown>
## Why do we all use git?
#### non-technical
- any workflow
- collaboration
- experimentation
- undo mistakes
- state of the art (best tool for the job)
- all the cool kids do it
Note:
-
</section>
<section class="slide level2" data-markdown>
## Why do we all use git?
#### technical
- never lose data (not just remote but also file integrity)
- easy conflict resolution
- local (your own copy of everything)
- implies speedy gonzales
Note:
-
</section>
</section>
</section>
<section>
<section id="prereq" class="titleslide slide level1" data-markdown>
### Block 1
## Git Demo
Note:
- vorher fragen, wer alles client braucht und noch accounts braucht, damit wir wissen,
wieviel zeit wir uns für try git nehmen können
- config
- init
- git add foo bar
- git commit -m 'foo bar'
- prima
</section>
</section>
<section>
<section id="prereq" class="titleslide slide level1" data-markdown>
### Block 1
## Checking Prerequisites
- GitHub / GitLab account
- local git client installation
- bonus: your own project without VCS
Note:
- wenn git client selbst nicht aufsetzen kann, dann bitte halbe stunde früher
- registration to the course
- git client includes your own notebook
</section>
</section>
<section class="slide level2" data-markdown>
##
-
Note:
-
</section>
</section>
<section>
<section class="titleslide slide level1" data-markdown>
# VCS for me
-
Note:
-
</section>
<section class="slide level2" data-markdown>
##
-
Note:
-
</section>
</section>
<section>
<section class="titleslide slide level1" data-markdown>
#
-
Note:
-
</section>
<section class="slide level2" data-markdown>
##
-
Note:
-
</section>
</section>
<section id="eof" data-background="img/trex.png"><h1>EOF</h1></section>
</div>
</div>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.js"></script>
<script>
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
maxScale: 1.5,
slideNumber: false,
theme: Reveal.getQueryHash().theme,
transition: Reveal.getQueryHash().transition || 'default',
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
]
});
</script>
</body>
</html>
handouts/git-pretty.png

675 KiB

img/git-merge-is-bad.png

307 KiB

...@@ -6,7 +6,7 @@ digraph { ...@@ -6,7 +6,7 @@ digraph {
node [color = orchid] node [color = orchid]
omaster[label = "master"] omain[label = "main"]
} }
subgraph clusterlocal { subgraph clusterlocal {
...@@ -14,7 +14,7 @@ digraph { ...@@ -14,7 +14,7 @@ digraph {
node [color = orchid] node [color = orchid]
master[label = "master"] main[label = "main"]
} }
subgraph clusterupstream { subgraph clusterupstream {
...@@ -22,11 +22,11 @@ digraph { ...@@ -22,11 +22,11 @@ digraph {
node [color = limegreen] node [color = limegreen]
umaster[label = "master"] umain[label = "main"]
} }
omaster -> master [label = "git pull"] omain -> main [label = "git pull"]
master -> omaster [label = "git push", constraint = false] main -> omain [label = "git push", constraint = false]
umaster -> master [label = "git pull upstream master", constraint = false] umain -> main [label = "git pull upstream main", constraint = false]
omaster -> umaster [label = "pull request (GitHub)\nmerge request (GitLab)", constraint = false] omain -> umain [label = "pull request (GitHub)\nmerge request (GitLab)", constraint = false]
} }
...@@ -6,7 +6,7 @@ digraph { ...@@ -6,7 +6,7 @@ digraph {
node [color = orchid] node [color = orchid]
omaster[label = "master"] omain[label = "main"]
} }
subgraph clusterlocal { subgraph clusterlocal {
...@@ -14,7 +14,7 @@ digraph { ...@@ -14,7 +14,7 @@ digraph {
node [color = orchid] node [color = orchid]
master[label = "master"] main[label = "main"]
} }
subgraph clusteralice { subgraph clusteralice {
...@@ -22,7 +22,7 @@ digraph { ...@@ -22,7 +22,7 @@ digraph {
node [color = limegreen] node [color = limegreen]
amaster[label = "master"] amain[label = "main"]
} }
subgraph clusterbob { subgraph clusterbob {
...@@ -30,11 +30,11 @@ digraph { ...@@ -30,11 +30,11 @@ digraph {
node [color = lightskyblue] node [color = lightskyblue]
bmaster[label = "master"] bmain[label = "main"]
} }
omaster -> master [label = "git pull"] omain -> main [label = "git pull"]
master -> omaster [label = "git push", constraint = false] main -> omain [label = "git push", constraint = false]
amaster -> master [label = "git pull alice", constraint = false] amain -> main [label = "git pull alice", constraint = false]
bmaster -> master [label = "git pull bob", constraint = false] bmain -> main [label = "git pull bob", constraint = false]
} }
...@@ -9,7 +9,7 @@ digraph { ...@@ -9,7 +9,7 @@ digraph {
node [color = orchid] node [color = orchid]
omaster[label = "master"] omain[label = "main"]
} }
subgraph clusterlocal { subgraph clusterlocal {
...@@ -17,10 +17,10 @@ digraph { ...@@ -17,10 +17,10 @@ digraph {
node [color = orchid] node [color = orchid]
master[label = "master"] main[label = "main"]
} }
omaster -> master [label = "git fetch", style = dotted, ltail = clusterorigin, lhead = clusterlocal] omain -> main [label = "git fetch", style = dotted, ltail = clusterorigin, lhead = clusterlocal]
master -> omaster [label = "git push"] main -> omain [label = "git push"]
omaster -> master [label = "git pull"] omain -> main [label = "git pull"]
} }
img/gitk-pretty-history.png

44.3 KiB | W: | H:

img/gitk-pretty-history.png

63.4 KiB | W: | H:

img/gitk-pretty-history.png
img/gitk-pretty-history.png
img/gitk-pretty-history.png
img/gitk-pretty-history.png
  • 2-up
  • Swipe
  • Onion skin
img/idiv-black-logo.png

10.1 KiB

img/idiv-black.png

34.9 KiB

File moved