SlideShare a Scribd company logo
1 of 70
Download to read offline
Workshop
Best practices with git
The essentials you should know
about git to use if efficiently
Otto Kekäläinen
OpenFest 7.11.2015
Sofia,Bulagaria
@ottokekalainen
●
15+ years in open source
●
technology & business & advocacy
●
development with git since 2010
The MariaDB Foundation
Continuity and open collaboration
●
MariaDB.org sponsors include MariaDB.com,Booking.com,
Automattic,Odin/Parallels,Visma...
●
Employs 6 persons,including ”Monty”Widenius,the creator of
MySQL/MariaDB
●
Single contact point for collaboration and contributions
●
The Foundation makes sure all pull requests and patches are
reviewed
●
All development work done with git at github.com/mariadb
Outline
1.The story of Git
2.Basic commands
3.Doing it with Github
4.Branches and tags
5.Git hooks and CI
6.Git internals
7. Advanced commands
8.Git everywhere?
Follow @ottokekalainen
to get a link to the slides
1.Story of Git
Git / t/ɡɪ
”A silly,incompetent,stupid,
annoying or childish person.”
http://en.wiktionary.org/wiki/git
"I'm an egotistical bastard,so I
name all my projects after myself.
First Linux,now Git”
Linus Torvalds,PC World.2012-07-14
Linus needed a new source code revision manager for
Linux,and none of the available options in 2005 where
good enough,so he wrote his own in.
Kernel 2.6.12 was the first release managed by Git and
version 1.0 of Git was released in December 2005.
Design goals of Git:
●
distributed revision management
●
protection against corruption,
both accidental and hostile
●
speed
Git popularity according to OpenHub.net
Git popularity according to Google Trends
git
svn
...but adoption would be faster if it was
not so difficult to use.
Originally Linus did not intend end users to use Git
directly,instead he tried to delegate to somebody
else the task of making the actual command line
interface. We are still waiting for it...
Luckily Git has been simplified and documentation
has improved over time,but some Git commands
still refer to Git internals that are difficult to grasp.
E.g. git-push: Update remote refs along with
associated objects.
Git might feel difficult at first,
but once you learn it, you never
want to go back to anything less
flexible and powerful.
Install on Linux:
apt-get install git git-gui
Install on Mac/Windows:
git-scm.com/downloads
2.Basic commands
First obstacle: same terms with different meanings
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
Define the author of commits
git init
git add example.txt
git commit -am “First commit”
# edit files
git commit -am “Second commit”
Start a new repository
git pull
# edit files
git commit -am “Implemented X”
git push
git log
git show
Typical workflow
How to write a good commit message
●
Your attitude towards commit messages should be the same as for code: it is
written once,but read thousands of times.
●
Don't explain how was done,that is visible in the diff anyway.Explain what the
intention was and why it was made.
●
Use imperative form “Fix typo”(instead of “Fixed typo”)
●
Keep subject line short and sweet,under 72 chars.Body can be verbose.
●
Use proper English.Capital letters.Reference issue identifiers is possible.
●
Looking for a good example? How about one by Linus himself?
https://github.com/torvalds/linux/commit/fc90888
Use git commit -a --amend to you screwed up
the commit and want to overwrite the latest
with an improved commit.
Completely delete the last commit:
git reset –hard HEAD^
Delete all untracked and modified files:
git clean -fdx && git reset --hard
3.Doing it with Github
Visit http://try.github.com/
After making your first repository,set up SSH key
for convenient authentication:
https://help.github.com/articles/generating-ssh-keys
Note: Github is not the only Git hosting site,
Gitlab and Bitbucket are popular too.
Exercise:
-go to https://github.com/ottok/git-training and fork it
-look at the fork under your own Github account and
clone it to your laptop
-edit names.txt and add yours
-push changes back to Github
-in Github,do a merge request back to me
git clone git://github.com/<yourname>/git-training.git
# edit names.txt
git commit -am “Added my name”
git push
# Open pull request on Github
The best part of Github is pull
requests,and how they enable
frictionless collaboration among
millions of developers
4.Branches and tags
Basically just labels that point to certain commit IDs.
Each commit ID point to its parent,thus forms a chain.
All developers branch from
master and then merge back.
New releases branch
from master.
Support releases branch
from release branch.
Image source:
http://tleyden.github.io/blog/
2014/04/09/a-successful-git-br
anching-model-with-enterprise-
support/
Git layout strategy 1/2
●
Start working on the master branch only.Don't create other
branches until you really need them.
●
Every new developer has their own branch (local clone).
●
Never break master. Push only stuff what works.Other
developers must be able to branch from master at any time
and start working on something new,instead of having to deal
with fixing a broken state that somebody else left in master.
Git layout strategy 2/2
●
If you have a need to push your work that is half-way done,that is a
good signal that you should create a new branch.
●
Typically tree kind of branches:
– feature branches
– bugfix branches
– personal branches
●
Project layout: split code up in many separate files.
– Lower likelihood of conflicting changes when branches merge.
Keep branch name visible in the bash prompt:
https://github.com/ottok/tooling/blob/master/bashrc/bashrc.git
Distributed version control?
Example scenarios at
https://git-scm.com/about/distributed
5.Git hooks and CI
Git commit hook: stop bad code entering repo
/.git/hooks$ cat pre-commit
#!/bin/bash
# Really fast check if syntax is at all parseable
for FILE in $(git diff --cached --name-only); do
if [[ "$FILE" =~ .php$ ]]; then
php -l "$FILE" 1> /dev/null
if [[ $? -ne 0 ]]; then
echo -e "e[1;33mAborting commit: PHP code contains syntax errorse[0m" >&2
exit 1
fi
fi
done
Want to put a simple shared repository on any SSH
capable server? Create a bare .git with no working files:
git init --bare
Want to have notifications when somebody commits?
Put a shell script at .git/hooks/post-receive
Continuous integration
●
Host your own Jenkins?
●
Travis-CI
6.Git internals
Folder /.git contains everything,
your / is just the working copy.
Folder /.git contains everything,
your / is just the working copy.
When you commit a 2 MB file /example.png,
your / will grow to 4 MB...
When you add a file,
it goes to the staging area.
The file does not go into the
actual history tree until the stage
is committed.
Commands push and pull and many other commands
are shortcuts that act with both
your local repository and the remote repositories.
Image credits Steve Bennet (http://steveko.wordpress.com/2012/02/24/10-things-i-hate-about-git/)
Git tracks content,not files!
Git history is immutable as each commit ID is the SHA-1 of
the commit data and metadata (including the commit ID of
parents).Changing any commit in the history will change the
SHA-1 commit IDs of every following commit in the chain.
If you need to change something in the history,you have to
rebase and make a new history.
Git commit IDs and rebase
Original git log –oneline
1bf7024 MDEV-8991: bind-address appears twice in default my.cnf
b2205c5 MDEV-9011: Redo log encryption does not work
cf9e6b2 Fix test failures seen on buildbot.
923827e MDEV-7949: Item_field::used_tables() takes 0.29% in OLTP RO
239e0c5 MDEV-8551 compilation fails with 10.1.6
After git rebase -i HEAD^^^
34350b9 MDEV-8991: bind-address appears twice in default my.cnf
f5f2dd9 MDEV-9011: Redo log encryption does not work
531e1ac Fixed all bugs
923827e MDEV-7949: Item_field::used_tables() takes 0.29% in OLTP RO
239e0c5 MDEV-8551 compilation fails with 10.1.6
Rebasing workflow
git rebase -i HEAD^^^
# pick in editor what commits you want to edit
# rebase automatically makes a checkout at intended commit
# edit the files
git commit -a --amend
git rebase --continue
# repeat until you reach the head of the branch
7.Advanced commands
Sorry,but default commands not very friendly,so get
yourself good cheat cheets and write up your common
commands once you've figured them out..
Image credits Steve Bennet (http://steveko.wordpress.com/2012/02/24/10-things-i-hate-about-git/)
Example of how fast-forward works 1/2
●
Branch“feature-branch-example”forked from master branch
“10.1”and has 3 commits
Example of how fast-forward works 2/2
●
Normal merge defaults to fast-forward in this case
●
●
●
Result of no fast-forward (git merge --no-ff)
Want to avoid “ugly”merge commits?
●
git config pull.ff=only
●
git config alias.ff=merge --ff-only
●
Run git rebase master to rebase you work on the master branch
before pushing or making pull request
– In MariaDB before submitting a pull request: git rebase 10.1
– You changes will be based on current 10.1 head and easy to merge
●
Run git merge on when importing changes from remote head only if
you really want to merge
Cherry-pick as alternative to merge
git cherry-pick 166a2f28487530ead0cf813ce0252baa
The commit with given ID will be applied as a new commit on
top of your current branch head.
Git bisect –find the commit that broke you app
git bisect bad # mark the checked out commit as bad
git bisect good mariadb-10.1.7 # mark the ref (=commit) good
git bisect run my-test.sh
Git automatically checks out every commit between “bad”and “good”and runs
the test script.
Test script is supposed to return 0 for good commits and non-0 for bad commits.
Exceptions are exit codes 255 and 125 that have special meaning to git bisect.
When the run is completed git will tell you the exact commit between “good”and
“bad”where the my-test.sh started to fail (exit code not 0).
Git stash as alternative to temp branch
git stash
# moves the current uncommited changes to the stash
git stash list
# shows what is stashed
git stash pop
# applies the latest stash on the checked out working tree
Compare changes and create diffs
git show 166a2f284875
# standard show in patch format
git diff v1.2.3..HEAD translations/ > new-translations.diff
# diff of all changes in directory translation/ since tag v.1.2.3
git diff branch1 branch2 # compare two branches
git diff branch1..branch2 # same as above
git diff branch1...branch2 # tree dots: changes on branch2 since it diverged
GUI tool: gitk
●
graphical tool to view git history (and also uncommitted changes)
●
shows all commits,tags,branch names etc in a nice way
●
with gitk you don’t need to checkout the branch/file to view it
●
includes search feature for both commit messages and commit contents
●
run “gitk example/file.h”to see the git log that affects a single file
●
“git gui blame”can be used to view graphically via the context menu that opens when
clicking on a commit with the secondary mouse button
●
view diff between any two diffs: click on first commit normally,and then click with
secondary button on the second commit and select from context menu to view the diff
●
run “gitk mariadb-10.1.4..mariadb-10.1.5”to view diff between two commits
●
you can also view diff between different branches like this
– gitk 10.1..HEAD vs gitk HEAD..10.1 vs gitk 10.1...HEAD
Other GUI tools
●
git citool –graphical tool to do selective commits easily
– you can click to select the files you want,individual hunks inside
files,and even individual lines inside hunks
– you can also write commits inside the tool’s window
●
git mergetool –tool for easy merging,
– automatically launches the pre-configured 3-way merge tool for
all conflicts (e.g.meld)
Compress and free up file space:
git repack-ad; git gc--aggressive
8.Git everywhere?
Git everywhere
●
Distributed permanent storage files system: https://ipfs.io/
●
Password manager: https://github.com/IJHack/qtpass
Would you like to store all your files in Git?
Git-annex
Diff of binary files?
Add in .git/config
[diff"odf"]
textconv=odt2txt
See also: http://www-verimag.imag.fr/~moy/opendocument/
Bug tracker as part of project?
http://bugseverywhere.org/
Bug tracker and wiki contents in Git?
trac+git
Clone wiki from Github with
git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.wiki.git
Publish to the web with one commit?
self-hosted Jekyll or
on Github https://pages.github.com/
Open source alternative to Dropbox based on Git?
http://sparkleshare.org/
Would you like others to
contribute to your software?
Provide easy forking (git clone),
easy way to develop new feature (git branch),
and an easy way to send them back (merge request).
Will Git credits replace developers CV's?
Is there anything we can't store and track in Git?
© 2015 MariaDB Foundation70
Thanks!
mariadb.org
@ottokekalainen
otto@mariadb.org

More Related Content

What's hot

Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionAnwarul Islam
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHubVikram SV
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Simplilearn
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdfTilton2
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab IntroductionKrunal Doshi
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction TutorialThomas Rausch
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucketSumin Byeon
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
 

What's hot (20)

Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Git
GitGit
Git
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git basics
Git basicsGit basics
Git basics
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Introducing GitLab
Introducing GitLabIntroducing GitLab
Introducing GitLab
 
Git101
Git101Git101
Git101
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
CI/CD with Github Actions
CI/CD with Github ActionsCI/CD with Github Actions
CI/CD with Github Actions
 

Viewers also liked

Ic maven jenkins_sonar
Ic maven jenkins_sonarIc maven jenkins_sonar
Ic maven jenkins_sonarRocío Muñoz
 
Continuous Delivery with Jenkins and Wildfly (2014)
Continuous Delivery with Jenkins and Wildfly (2014)Continuous Delivery with Jenkins and Wildfly (2014)
Continuous Delivery with Jenkins and Wildfly (2014)Tracy Kennedy
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeTeerapat Khunpech
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabShinu Suresh
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for TestingCarlos Sanchez
 
Master Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins PlatformMaster Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins Platformdcjuengst
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for DocumentationAnne Gentle
 
Game of Codes: the Battle for CI
Game of Codes: the Battle for CIGame of Codes: the Battle for CI
Game of Codes: the Battle for CIAtlassian
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with JenkinsEdureka!
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentRise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentSven Peters
 
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDocker, Inc.
 
Bamboo - an introduction
Bamboo - an introductionBamboo - an introduction
Bamboo - an introductionSven Peters
 
Dockercon2015 bamboo
Dockercon2015 bambooDockercon2015 bamboo
Dockercon2015 bambooSteve Smith
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideRohit Arora
 
Jenkins Docker
Jenkins DockerJenkins Docker
Jenkins DockerAlex Soto
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners HubSpot
 
DevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for DockerDevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for DockerSonatype
 
Seven Habits of Highly Effective Jenkins Users (2014 edition!)
Seven Habits of Highly Effective Jenkins Users (2014 edition!)Seven Habits of Highly Effective Jenkins Users (2014 edition!)
Seven Habits of Highly Effective Jenkins Users (2014 edition!)Andrew Bayer
 

Viewers also liked (20)

Ic maven jenkins_sonar
Ic maven jenkins_sonarIc maven jenkins_sonar
Ic maven jenkins_sonar
 
Continuous Delivery with Jenkins and Wildfly (2014)
Continuous Delivery with Jenkins and Wildfly (2014)Continuous Delivery with Jenkins and Wildfly (2014)
Continuous Delivery with Jenkins and Wildfly (2014)
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTree
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Master Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins PlatformMaster Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins Platform
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for Documentation
 
Game of Codes: the Battle for CI
Game of Codes: the Battle for CIGame of Codes: the Battle for CI
Game of Codes: the Battle for CI
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with Jenkins
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentRise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
 
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
 
Bamboo - an introduction
Bamboo - an introductionBamboo - an introduction
Bamboo - an introduction
 
Dockercon2015 bamboo
Dockercon2015 bambooDockercon2015 bamboo
Dockercon2015 bamboo
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guide
 
Jenkins Docker
Jenkins DockerJenkins Docker
Jenkins Docker
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
DevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for DockerDevOps and Continuous Delivery reference architectures for Docker
DevOps and Continuous Delivery reference architectures for Docker
 
Seven Habits of Highly Effective Jenkins Users (2014 edition!)
Seven Habits of Highly Effective Jenkins Users (2014 edition!)Seven Habits of Highly Effective Jenkins Users (2014 edition!)
Seven Habits of Highly Effective Jenkins Users (2014 edition!)
 
Speaking part 3
Speaking part 3Speaking part 3
Speaking part 3
 

Similar to Git best practices workshop

Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincitOy
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanJames Ford
 
Git tech talk
Git tech talkGit tech talk
Git tech talkrazasayed
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testersupadhyay_25
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystemFrançois D'Agostini
 
Git Merge, Resets and Branches
Git Merge, Resets and BranchesGit Merge, Resets and Branches
Git Merge, Resets and BranchesVictor Pudelski
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?9 series
 

Similar to Git best practices workshop (20)

Git and Github workshop
Git and Github workshopGit and Github workshop
Git and Github workshop
 
Git essentials
Git essentialsGit essentials
Git essentials
 
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Git workshop
Git workshopGit workshop
Git workshop
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
Git training with Devaamo
Git training with DevaamoGit training with Devaamo
Git training with Devaamo
 
3 Git
3 Git3 Git
3 Git
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Git kelvin
Git   kelvinGit   kelvin
Git kelvin
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawan
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testers
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Git Series - Part 1
Git Series - Part 1 Git Series - Part 1
Git Series - Part 1
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
 
Git Merge, Resets and Branches
Git Merge, Resets and BranchesGit Merge, Resets and Branches
Git Merge, Resets and Branches
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 

More from Otto Kekäläinen

FOSDEM2021: MariaDB post-release quality assurance in Debian and Ubuntu
FOSDEM2021: MariaDB post-release quality assurance in Debian and UbuntuFOSDEM2021: MariaDB post-release quality assurance in Debian and Ubuntu
FOSDEM2021: MariaDB post-release quality assurance in Debian and UbuntuOtto Kekäläinen
 
Search in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize itSearch in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize itOtto Kekäläinen
 
MariaDB quality assurance in Debian and Ubuntu
MariaDB quality assurance in Debian and UbuntuMariaDB quality assurance in Debian and Ubuntu
MariaDB quality assurance in Debian and UbuntuOtto Kekäläinen
 
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?Otto Kekäläinen
 
Technical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 editionTechnical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 editionOtto Kekäläinen
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...Otto Kekäläinen
 
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...Otto Kekäläinen
 
DebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoFDebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoFOtto Kekäläinen
 
The 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themThe 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themOtto Kekäläinen
 
How to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressHow to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressOtto Kekäläinen
 
Automatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themesAutomatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themesOtto Kekäläinen
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...Otto Kekäläinen
 
Automatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress pluginsAutomatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress pluginsOtto Kekäläinen
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Otto Kekäläinen
 
WordPress-tietoturvan perusteet
WordPress-tietoturvan perusteetWordPress-tietoturvan perusteet
WordPress-tietoturvan perusteetOtto Kekäläinen
 
Technical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 editionTechnical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 editionOtto Kekäläinen
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingOtto Kekäläinen
 
MariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environmentsMariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environmentsOtto Kekäläinen
 
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017Otto Kekäläinen
 

More from Otto Kekäläinen (20)

FOSDEM2021: MariaDB post-release quality assurance in Debian and Ubuntu
FOSDEM2021: MariaDB post-release quality assurance in Debian and UbuntuFOSDEM2021: MariaDB post-release quality assurance in Debian and Ubuntu
FOSDEM2021: MariaDB post-release quality assurance in Debian and Ubuntu
 
Search in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize itSearch in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize it
 
MariaDB quality assurance in Debian and Ubuntu
MariaDB quality assurance in Debian and UbuntuMariaDB quality assurance in Debian and Ubuntu
MariaDB quality assurance in Debian and Ubuntu
 
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?
 
Technical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 editionTechnical SEO for WordPress - 2019 edition
Technical SEO for WordPress - 2019 edition
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...
 
DebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoFDebConf 2019 MariaDB packaging in Debian BoF
DebConf 2019 MariaDB packaging in Debian BoF
 
The 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themThe 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix them
 
How to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressHow to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPress
 
Technical SEO for WordPress
Technical SEO for WordPressTechnical SEO for WordPress
Technical SEO for WordPress
 
Automatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themesAutomatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themes
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
Automatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress pluginsAutomatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress plugins
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)
 
WordPress-tietoturvan perusteet
WordPress-tietoturvan perusteetWordPress-tietoturvan perusteet
WordPress-tietoturvan perusteet
 
Technical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 editionTechnical SEO for WordPress - 2017 edition
Technical SEO for WordPress - 2017 edition
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
 
MariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environmentsMariaDB adoption in Linux distributions and development environments
MariaDB adoption in Linux distributions and development environments
 
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
 

Recently uploaded

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 

Recently uploaded (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 

Git best practices workshop

  • 1. Workshop Best practices with git The essentials you should know about git to use if efficiently Otto Kekäläinen OpenFest 7.11.2015 Sofia,Bulagaria
  • 2. @ottokekalainen ● 15+ years in open source ● technology & business & advocacy ● development with git since 2010
  • 3. The MariaDB Foundation Continuity and open collaboration ● MariaDB.org sponsors include MariaDB.com,Booking.com, Automattic,Odin/Parallels,Visma... ● Employs 6 persons,including ”Monty”Widenius,the creator of MySQL/MariaDB ● Single contact point for collaboration and contributions ● The Foundation makes sure all pull requests and patches are reviewed ● All development work done with git at github.com/mariadb
  • 4. Outline 1.The story of Git 2.Basic commands 3.Doing it with Github 4.Branches and tags 5.Git hooks and CI 6.Git internals 7. Advanced commands 8.Git everywhere? Follow @ottokekalainen to get a link to the slides
  • 6. Git / t/ɡɪ ”A silly,incompetent,stupid, annoying or childish person.” http://en.wiktionary.org/wiki/git
  • 7. "I'm an egotistical bastard,so I name all my projects after myself. First Linux,now Git” Linus Torvalds,PC World.2012-07-14
  • 8. Linus needed a new source code revision manager for Linux,and none of the available options in 2005 where good enough,so he wrote his own in. Kernel 2.6.12 was the first release managed by Git and version 1.0 of Git was released in December 2005.
  • 9. Design goals of Git: ● distributed revision management ● protection against corruption, both accidental and hostile ● speed
  • 10. Git popularity according to OpenHub.net
  • 11. Git popularity according to Google Trends git svn
  • 12. ...but adoption would be faster if it was not so difficult to use. Originally Linus did not intend end users to use Git directly,instead he tried to delegate to somebody else the task of making the actual command line interface. We are still waiting for it... Luckily Git has been simplified and documentation has improved over time,but some Git commands still refer to Git internals that are difficult to grasp. E.g. git-push: Update remote refs along with associated objects.
  • 13. Git might feel difficult at first, but once you learn it, you never want to go back to anything less flexible and powerful.
  • 14. Install on Linux: apt-get install git git-gui Install on Mac/Windows: git-scm.com/downloads
  • 16. First obstacle: same terms with different meanings
  • 17. git config --global user.name "John Doe" git config --global user.email johndoe@example.com Define the author of commits
  • 18. git init git add example.txt git commit -am “First commit” # edit files git commit -am “Second commit” Start a new repository
  • 19. git pull # edit files git commit -am “Implemented X” git push git log git show Typical workflow
  • 20. How to write a good commit message ● Your attitude towards commit messages should be the same as for code: it is written once,but read thousands of times. ● Don't explain how was done,that is visible in the diff anyway.Explain what the intention was and why it was made. ● Use imperative form “Fix typo”(instead of “Fixed typo”) ● Keep subject line short and sweet,under 72 chars.Body can be verbose. ● Use proper English.Capital letters.Reference issue identifiers is possible. ● Looking for a good example? How about one by Linus himself? https://github.com/torvalds/linux/commit/fc90888
  • 21. Use git commit -a --amend to you screwed up the commit and want to overwrite the latest with an improved commit. Completely delete the last commit: git reset –hard HEAD^ Delete all untracked and modified files: git clean -fdx && git reset --hard
  • 22. 3.Doing it with Github
  • 23.
  • 24. Visit http://try.github.com/ After making your first repository,set up SSH key for convenient authentication: https://help.github.com/articles/generating-ssh-keys Note: Github is not the only Git hosting site, Gitlab and Bitbucket are popular too.
  • 25. Exercise: -go to https://github.com/ottok/git-training and fork it -look at the fork under your own Github account and clone it to your laptop -edit names.txt and add yours -push changes back to Github -in Github,do a merge request back to me
  • 26. git clone git://github.com/<yourname>/git-training.git # edit names.txt git commit -am “Added my name” git push # Open pull request on Github
  • 27. The best part of Github is pull requests,and how they enable frictionless collaboration among millions of developers
  • 29. Basically just labels that point to certain commit IDs. Each commit ID point to its parent,thus forms a chain.
  • 30. All developers branch from master and then merge back. New releases branch from master. Support releases branch from release branch. Image source: http://tleyden.github.io/blog/ 2014/04/09/a-successful-git-br anching-model-with-enterprise- support/
  • 31. Git layout strategy 1/2 ● Start working on the master branch only.Don't create other branches until you really need them. ● Every new developer has their own branch (local clone). ● Never break master. Push only stuff what works.Other developers must be able to branch from master at any time and start working on something new,instead of having to deal with fixing a broken state that somebody else left in master.
  • 32. Git layout strategy 2/2 ● If you have a need to push your work that is half-way done,that is a good signal that you should create a new branch. ● Typically tree kind of branches: – feature branches – bugfix branches – personal branches ● Project layout: split code up in many separate files. – Lower likelihood of conflicting changes when branches merge.
  • 33. Keep branch name visible in the bash prompt: https://github.com/ottok/tooling/blob/master/bashrc/bashrc.git
  • 34. Distributed version control? Example scenarios at https://git-scm.com/about/distributed
  • 36. Git commit hook: stop bad code entering repo /.git/hooks$ cat pre-commit #!/bin/bash # Really fast check if syntax is at all parseable for FILE in $(git diff --cached --name-only); do if [[ "$FILE" =~ .php$ ]]; then php -l "$FILE" 1> /dev/null if [[ $? -ne 0 ]]; then echo -e "e[1;33mAborting commit: PHP code contains syntax errorse[0m" >&2 exit 1 fi fi done
  • 37. Want to put a simple shared repository on any SSH capable server? Create a bare .git with no working files: git init --bare Want to have notifications when somebody commits? Put a shell script at .git/hooks/post-receive
  • 38. Continuous integration ● Host your own Jenkins? ● Travis-CI
  • 40. Folder /.git contains everything, your / is just the working copy.
  • 41. Folder /.git contains everything, your / is just the working copy. When you commit a 2 MB file /example.png, your / will grow to 4 MB...
  • 42. When you add a file, it goes to the staging area. The file does not go into the actual history tree until the stage is committed.
  • 43. Commands push and pull and many other commands are shortcuts that act with both your local repository and the remote repositories.
  • 44. Image credits Steve Bennet (http://steveko.wordpress.com/2012/02/24/10-things-i-hate-about-git/)
  • 45.
  • 46. Git tracks content,not files! Git history is immutable as each commit ID is the SHA-1 of the commit data and metadata (including the commit ID of parents).Changing any commit in the history will change the SHA-1 commit IDs of every following commit in the chain. If you need to change something in the history,you have to rebase and make a new history.
  • 47. Git commit IDs and rebase Original git log –oneline 1bf7024 MDEV-8991: bind-address appears twice in default my.cnf b2205c5 MDEV-9011: Redo log encryption does not work cf9e6b2 Fix test failures seen on buildbot. 923827e MDEV-7949: Item_field::used_tables() takes 0.29% in OLTP RO 239e0c5 MDEV-8551 compilation fails with 10.1.6 After git rebase -i HEAD^^^ 34350b9 MDEV-8991: bind-address appears twice in default my.cnf f5f2dd9 MDEV-9011: Redo log encryption does not work 531e1ac Fixed all bugs 923827e MDEV-7949: Item_field::used_tables() takes 0.29% in OLTP RO 239e0c5 MDEV-8551 compilation fails with 10.1.6
  • 48. Rebasing workflow git rebase -i HEAD^^^ # pick in editor what commits you want to edit # rebase automatically makes a checkout at intended commit # edit the files git commit -a --amend git rebase --continue # repeat until you reach the head of the branch
  • 50. Sorry,but default commands not very friendly,so get yourself good cheat cheets and write up your common commands once you've figured them out.. Image credits Steve Bennet (http://steveko.wordpress.com/2012/02/24/10-things-i-hate-about-git/)
  • 51.
  • 52. Example of how fast-forward works 1/2 ● Branch“feature-branch-example”forked from master branch “10.1”and has 3 commits
  • 53. Example of how fast-forward works 2/2 ● Normal merge defaults to fast-forward in this case ● ● ● Result of no fast-forward (git merge --no-ff)
  • 54. Want to avoid “ugly”merge commits? ● git config pull.ff=only ● git config alias.ff=merge --ff-only ● Run git rebase master to rebase you work on the master branch before pushing or making pull request – In MariaDB before submitting a pull request: git rebase 10.1 – You changes will be based on current 10.1 head and easy to merge ● Run git merge on when importing changes from remote head only if you really want to merge
  • 55. Cherry-pick as alternative to merge git cherry-pick 166a2f28487530ead0cf813ce0252baa The commit with given ID will be applied as a new commit on top of your current branch head.
  • 56. Git bisect –find the commit that broke you app git bisect bad # mark the checked out commit as bad git bisect good mariadb-10.1.7 # mark the ref (=commit) good git bisect run my-test.sh Git automatically checks out every commit between “bad”and “good”and runs the test script. Test script is supposed to return 0 for good commits and non-0 for bad commits. Exceptions are exit codes 255 and 125 that have special meaning to git bisect. When the run is completed git will tell you the exact commit between “good”and “bad”where the my-test.sh started to fail (exit code not 0).
  • 57. Git stash as alternative to temp branch git stash # moves the current uncommited changes to the stash git stash list # shows what is stashed git stash pop # applies the latest stash on the checked out working tree
  • 58. Compare changes and create diffs git show 166a2f284875 # standard show in patch format git diff v1.2.3..HEAD translations/ > new-translations.diff # diff of all changes in directory translation/ since tag v.1.2.3 git diff branch1 branch2 # compare two branches git diff branch1..branch2 # same as above git diff branch1...branch2 # tree dots: changes on branch2 since it diverged
  • 59. GUI tool: gitk ● graphical tool to view git history (and also uncommitted changes) ● shows all commits,tags,branch names etc in a nice way ● with gitk you don’t need to checkout the branch/file to view it ● includes search feature for both commit messages and commit contents ● run “gitk example/file.h”to see the git log that affects a single file ● “git gui blame”can be used to view graphically via the context menu that opens when clicking on a commit with the secondary mouse button ● view diff between any two diffs: click on first commit normally,and then click with secondary button on the second commit and select from context menu to view the diff ● run “gitk mariadb-10.1.4..mariadb-10.1.5”to view diff between two commits ● you can also view diff between different branches like this – gitk 10.1..HEAD vs gitk HEAD..10.1 vs gitk 10.1...HEAD
  • 60. Other GUI tools ● git citool –graphical tool to do selective commits easily – you can click to select the files you want,individual hunks inside files,and even individual lines inside hunks – you can also write commits inside the tool’s window ● git mergetool –tool for easy merging, – automatically launches the pre-configured 3-way merge tool for all conflicts (e.g.meld)
  • 61. Compress and free up file space: git repack-ad; git gc--aggressive
  • 63. Git everywhere ● Distributed permanent storage files system: https://ipfs.io/ ● Password manager: https://github.com/IJHack/qtpass
  • 64. Would you like to store all your files in Git? Git-annex Diff of binary files? Add in .git/config [diff"odf"] textconv=odt2txt See also: http://www-verimag.imag.fr/~moy/opendocument/
  • 65. Bug tracker as part of project? http://bugseverywhere.org/ Bug tracker and wiki contents in Git? trac+git Clone wiki from Github with git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.wiki.git
  • 66. Publish to the web with one commit? self-hosted Jekyll or on Github https://pages.github.com/ Open source alternative to Dropbox based on Git? http://sparkleshare.org/
  • 67. Would you like others to contribute to your software? Provide easy forking (git clone), easy way to develop new feature (git branch), and an easy way to send them back (merge request).
  • 68. Will Git credits replace developers CV's?
  • 69. Is there anything we can't store and track in Git?
  • 70. © 2015 MariaDB Foundation70 Thanks! mariadb.org @ottokekalainen otto@mariadb.org