Commit 45a815ec authored by nilsl's avatar nilsl
Browse files

Merge branch 'master' of

parents 5271f71f b0a8fb30
This diff is collapsed.
% generic colors
% TheAlternative colors
%Apply TheAlt colors to theme
\setbeamercolor{section in head/foot}{fg=ldorange}
\setbeamercolor{author in head/foot}{fg=white}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamercolor{caption name}{fg=vlg}
\setbeamertemplate{itemize item}[circle]
\setbeamercolor{itemize item}{fg=ldorange}
% make including pdfs work
\setbeamercolor{background canvas}{bg=}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{bibliography item}[text]
% white-on-black lstlisting env with rounded corners
\tcblisting{listing only,colback=black,colframe=black,
enlarge top by=0mm,left=-0mm,top=-2mm,bottom=-2mm,
listing options={language=bash,
% mark a spot for e.g. drawing an arrow to it
\newcommand\tikzmark[1]{\tikz[remember picture,overlay]\node[inner xsep=0pt](#1){};}
% \newcommand\Warning{%
% \makebox[1.4em][c]{\raisebox{-0.45em}{%
% \makebox[0pt][c]{\raisebox{0.25em}{\large!}}%
% \makebox[0pt][c]{\color{red}\Huge$\bigtriangleup$}}}%
% \hspace{0.7em}%
% }
% a red warning box
Please see here:
\ No newline at end of file
body { font-family: sans-serif; }
h1, h2, h3 {
font-family: serif;
font-weight: normal;
.remark-code, .remark-inline-code { font-family: monospace; }
\ No newline at end of file
<!DOCTYPE html>
<title>Git & Gitlab</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="css/remark.css">
<textarea id="source">
class: center, middle
# Collaboration with git & Gitlab
<img src="images/UZH-logo.png" width="30%">
<img src="images/thealternative-logo.jpg" width="30%">
# Why _git_
**Change control**
- keep track of who changed what
- revert changes easily
no more presentation_v2_final_FINAL.pptx
**Backup & distribute**
- store important files remotely
- easily copy and maintain on different devices
- share and edit with collaborators
no more inconsistent state
- strict version control helps you to work goal oriented
no more chaotic changes
# Installing _git_
Download *git* for your operating system from [](
<img src="images/git_download.png" width="100%">
class: center, middle
# Local workflow with Command Line
# Creating a local repository
open your `Git-Bash`
create a new directory
mkdir mywebsite
change into that directory
cd mywebsite
turn this folder into a git repository
git init
# Checking your local repository
you check the status of your repository using
git status
which should give you
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
# Change something & commit it
In your folder `mywebsite` create a file `helloworld.html` with the content
<h1>Hello World!</h1>
check how git sees that file
git status
which tells you that there are
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
nothing added to commit but untracked files present (use "git add" to track)
# Change something & commit it
so let's follow the advice and do
git add helloworld.html
and then **commit** this change
git commit -m 'add my first file'
you can always check everything you did with
git log
commit 3b5616d1ba962e7a2e4af1f1bdd54f5d65d4e22d (HEAD -> master)
Author: Oscan Openness <>
Date: Sun Jan 12 12:20:28 2020 +0100
class: center, middle
# Remote workflow with Gitlab
# Login to gitlab
create an account (with switch edu) if you have none
# Create a gitlab project (1/2)
<img src="images/gitlab_create_new_project.jpg" width="100%">
# Create a gitlab project (2/2)
<img src="images/gitlab_create_new_project_2.jpg" width="100%">
# Finish setup gitlab
create a password in the settings
add an SSH key (optional)
<img src="images/gitlab_project_created.jpg" width="100%">
# Finish local setup
<img src="images/gitlab_local_setup_account.jpg" width="100%">
<img src="images/gitlab_local_setup_repository.jpg" width="100%">
(skip the `git init`, `git add .` and `git commit -m "Initial commit` steps)
# Add a readme
explain your project for others and your future self
<img src="images/gitlab_add_readme.jpg" width="100%">
# Add a license
everything you write has Copyright
Copyright gives you exclusive rights (no one can use it without permission)
use a license to define permissions for others
MIT to allow usage without restrictions
GPL to allow usage if basic freedom granted to users
(many others)
<img src="images/gitlab_add_license.jpg" width="100%">
class: center, middle
# Github Desktop to simplify
# Install github desktop
download from
then open your repository folder
<img src="images/github_add_repository.jpg" width="100%">
# Pull changes
download the changes made on gitlab
<img src="images/github_pull_pending.jpg" width="100%">
# Commit changes
change your local file
then preview the changes and then commit
<img src="images/github_changes.jpg" width="100%">
# Push changes
push the changes
<img src="images/github_push_pending.jpg" width="100%">
# View history
see the changes you've made in the past
<img src="images/github_history.jpg" width="100%">
# Introduction done
play around with it!
we are here to answer questions.
- add some of your documents to git
- change two files but only commit one
- revert changes
in 30 Minutes we will start with advanced topics.
# Advanced topics
best-practices for commits
create branch & merge request
create issue & mention it in commit
use SSH key
fork & merge back into origin
add different remotes
# Best practices for commits
- single purpose
Improve best practice slide
- short, imperative subject line
Add best practice slide
- tell why, not how
Make wording on slides consistent
# Create branch & merge request
- create branch
git checkout -b new-branch
- push
git push --set-upstream origin new-branch
- merge (on gitlab)
# Create issue & mention it in commit
- create issue on gitlab
- commit local change with `#1` for `1` the issue number
git commit -m "resolve #1"
- push
- go to the issue on and observe
# Use SSH key
- create SSH key
ssh-keygen -t rsa -b 4096 -C "" && eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
- copy `~/.ssh/`
- add the public key on
- clone with SSH
- try out push/pull to see it working
<script src="js/remark.min.js" type="text/javascript"></script>
<script src="js/remark.driver.js" type="text/javascript"></script>
git /gitlab tutorial planned for UZH zentrale informatik
target group:
bachelor informatik
master/phd students
both mostly want to use git with code or latex
version control (backup, recover old state, make changes visible)
publish (how, which license)
contribute (work together on same project)
presentation and then practical examples for each topic
for each topic add link/resource to more advanced explanations
motivation 10'/5':
demonstrate how git can recover files and make visible who changed what
explain service provider benefits (backup, collaboration)
ask what interest of participants are to focus advanced topics
git intro 5'/15':
install git
create first local repository
do first commit
show it worked with git status / git log
remote intro 10'/30':
create repository online
do steps of git global config on welcome screen
do steps of create new repository on welcome screen
edit Readme to learn about markdown
do add license on gitlab webpage
git GUI client 5'/15':
install github desktop
open repo & do commit
sync with push/pull
view changes of previous commits
advanced topics sorted by preference (each around 20'):
create branch & merge request
create issue & mention it in commit
fork & merge back into origin
add different remotes
use SSH key
resources considered:
compicampus course gives a good overview, but not suitable structured has many advanced resources
git boot on has many advanced resources
cheatsheet github
"git for ages 4 and up" (well made youtube tutorial)
personal experience
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment