SlideShare a Scribd company logo
1 of 112
Git Luca Milanesio Android programming Sang Shin The Productive Programmer Neal Ford The Power of Retrospection Linda Rising Introduction to Scala Hubert Plociniczak Main sponsor
Agenda SCM and Git Concepts Git quick start Branching and merging Resolving conflicts Reverting changes Working with tags Git remotes Git on the server Git peer-to-peer Git democracy
Who’s that guy ? Luca MilanesioLMIT Limited – Director / co-founder of GitEnterprise.com Jenkins (formerly Hudson) contributor since 2007founder of hudson-mobi.com Over 18 years of experience in Software and Services Development and Application Lifecycle Worked for major UK, EU and US Customers Banking, Retailers, Industry, Finance, Telecoms, Utilities, Government Git enthusiast since 2009 and innovator in Vodafone Group Services Ltd
About SCM … remember ? SCM = Source Code Management ,[object Object]
Commit and rollback changes
Define change-sets
Tag important releases
Manage branches of development
Integrate the work of multiple teams together
… and much more Picture courtesyofglobalnerdy.com - Allrightskindlyreserved
Brief history of OpenSourceSCMs Local SCMs (versions kept on local filesystem) SCCS (1972) … I was not yet born, don’t remember  RCS (1982) the most widely used on Unix Server-based SCMs (central repository server) CVS (1990) first widely used SCM server Subversion (2000) first widely Internet SCM … and then let’s to go distributed … DCVS (2002) who has ever used it ? Mercurial and Git (2005)
Centralised vs. distributed ? How many of you are using central repositories ? CVS-boys  … raise your hands ! SVN-guys … it’s your turn ! How many are for distributed repositories ? Mercurial-scientists ... raise your hands ! Git-explorers … brave men !
Who’s right ? Central SCM Unique “source of truth” Central back-up Seamless alignment for all developers Security and access control Distributed SCM Community code-base No single-point-of-failure Peer-to-peer alignment Continuous branching and merging
Why GIT ? It’s all about BitKeeper fault: they broke up with LinusTorvalds … and I’m not kidding  Story: Linux Kernel SCM: BitKeeper Apr 2005 – Linus writes PERL scripts for Linux Kernel SCM Jul 2005 … Git 0.99 is out ! Git principles: Allow the BitKeeper SCM workflow Use CVS as the “not-to-do” example Check and prevent corruption Make it FFF … FAST FAST FAST !
BORED of too much theory ?
Let’s experimentGit in action !
Git installation (Ver. >=1.6) Linux (Gitfavourite of course !) Ubuntu: sudo apt-get install git-core other Linux ? … best from source codehttp://git-scm.com/ Mac OSX http://code.google.com/p/git-osx-installer/ Windows http://code.google.com/p/msysgit/(sucks … but it’s your fault not using Unix) CygwinHIGHLY RECOMMENDED (mandatory IMHO)
Step 1 – Git repository ,[object Object]
cd into project
$ git init,[object Object]
Define your e-mail
Everything stored in .git/config,[object Object]
Add to GIT (default = recursive)
Commit,[object Object]
Display changes,[object Object]
State 1. unstaged Create a new file Change an existing file Check status
State 2. staged Add the two files to staging area Check status
State 3. work directory clean Commit the staging area Check status
Display Git lifecycle Add another file and make some changes $ gitgui
Stage with gitgui Select files and chose “Stage to commit”
Commit with gitgui Enter commit message and click “commit”
Git graph log with gitk
Playtime is over 
Git stores the whole file Git is different from SVN: no diffs, just whole files Git stores changed files between snapshots(BitKeeperdocet) Picture courtesyofProGit.org
Git object types: blobs Git stores all files (and their versions) as objects (blobs) Each object has a SHA-1 160-bit identifier SHA-1 provides: Unique Global ID Integrity check Example: File content: “You're GIT too” SHA-1: bbecf72783dfba9e0243e13dbb5fb04ed39ed4e4 (Hex) Track content (not files) Automatically detect renames … cool !
SHA-1 ? WTF … Why LinusTorvalds has chosen SHA-1 hashing ? Need for track content globally SHA-1 collision probability is 1/251 What happens if two files have same SHA-1 ? BOOM ! What is the probability of it ? World’s population (7 BN people)sharing files of 10 times Linux Kernel  Possible ? More likely to be hit by a 15 KM asteroid NOW !!!
Git object types: commits and trees Git tree identifies a snapshot (set of files) Git commit identifies Author / Committer Commit message Timestamp Tree Picture courtesyofProGit.org
Git history: graph of commits Every commit points to its predecessor Series of commits make Git repository history Picture courtesyofProGit.org
Where are Git objects ? Git objects are in .git/objects SHA-1 identify directory / file
Curious about Git objects ? Git objects are compressed Use git show to display content
Getting lost ? How to remember SHA-1 hashing codes ? How Git stores the “pointers” to Commit graph ? Git references are the solution ! Head of the Git history Intermediate tags Branch points Relative points
Git references References: “labels” for Git SHA-1 commit IDs Stored as files under .git/refs Reference types: Tags Heads (branches) HEAD is a special ref:always points tohead of currentbranch.
How Git commits graph looks like ? Reference Commit Tree Picture courtesyofProGit.org
What is a branch for Git ? Git named branch = reference to a commit ID (head of branch) Git supports “network” of commits, with named and unnamed branches … don’t know why Git reminds me some “underground” branches 
Real-life Git branches Think I’m exaggerating ? Look at this example (it’s real, swear !)
Let’s practice  on Git branches !
Wear “life jacket” first Get Git bash extensions source git/contrib/completion/git-completion.bash Redefine promptexport PS1='$(__git_ps1 " (%s)")  ’ ... and your current branch is visible on your prompt: you will not get lost 
Creating branches Create branch  create a new ref to current commit
Switching branch Use git checkout to switch branch Current displayed branch changed to experimental Note that HEAD points to experimental
Commit on branch Add a new commit to experimental branch See the new branch graph (gitk)
Merge When experiments are completed … merge back ! Checkout master Merge experimental
Git graph after merge Let’s have a look on the result with gitk Merge-type applied: Fast-forward (move refs in history) Branch has been “flattened” Experimental just another ref to master
Git recursive-merge Let’s create some divergence Changes on both master and experimental Fast-forward merge = move branch ref to another commit ID
Git diverging branches Use gitk --all to display all branchesNOTE: no args displays just current branch experimental is really diverging from master
Git recursive merge Let’s merge again with master This is a real merge folks ! NOTE: Merge is a Git commit: you can associate a comment, or revert it later ! Don’t be scared by Git-managed merge 
Merge alternatives: rebase Picture courtesyofProGit.org
Git rebase in action Let’s diverge again between master and experimental Magic ! … rebase flattens the branching history
Git graph after rebase Experimental is no more a diverging branch NOTE: Marconi’s test is on “unnamed branch” and experimental branch history has changed !
Merge alternatives: squash origin C1 C2 C3 C4 C5 C6 C1 C2 C3 C4 C3 C4 C3’+C4’ mywork origin mywork
Git squash in action Get branch changes but do not join them git merge –squash experimentalcommit
Git branch graph after squash Branches are still diverging Get all the branch changes in a single commit(squash changes together)
Merge alternatives: cherry-pick origin C1 C2 C3 C4 C5 C6 C1 C2 C3 C4 C5 C6 C6’ mywork origin mywork
Merge alternatives: cherry-pick Get individual commit IDs Apply individual changes to another branch
Git branch graph after cherry-pick Individual commit has been copied from tesla-test Both branches are kept
Too easy ? … let’s create some conflict !
Merge conflict Same file changed, same range, two different branches
Resolving conflict Get list of conflicts with git status Display and edit conflicted file
Completing merge Add edited file to stage Commit and finalise the merged commit … wasn’t that scary isn’t it ? 
Rebase / cherry-pick conflict Same file changed,  same range,  two different branches
Don’t panic … unnamed branch Check in which branch you are Check files in conflict
Resolve conflict and continue rebase Resolve conflicts Continue rebase
Got lost with commands, merge and conflicts ?
Merge recap
Reverting changes
Git is powerful and dangerous Git has full control on history Amend existing commits Remove commits Revert changes Be careful: you could destroy your history ! Be even more careful: history revert is unrecoverable SCARY !!!!!
Change existing commits Git commit support the “amend” option to overwrite committed data What can be amended File changes  Author / comment Date The original commit will disappear: amend is NOT revertible (but just amended again)
Amend last commit Let’s display the last commit on master
Amend last commit Let’s change commit content
Git reset: back to the past Git reset allows to: Put committed data back to the working dir  soft reset Remove completely committed data  hard reset Git reset is NOT revertible You want to reset ? Do you really need it ? Do you really want it ? What do you want to achieve ? … and then think again …
Soft reset Remove the last commit and put changes back to workdir Hint: master~1 = reference to  “one commit before  master head” Commit is lost, but you still have the changes in workdir
Hard reset Remove commit and all the changes associated Commit is lostFOREVER: there is no way to restore the data
Git revert Git revert allows to: Revert the changes and to workdir Revert the changes and create a “reverted commit” Git revert is revertible Revert = negative commit (eliminates effect of reverted commit)
Display last commit Let’s display the last commit changes on master
Create reverted commit Let’s revert last commit
Now: how to revert the revert ? Reverted commit is a commit Use reset to eliminate the revert operation
Working with Tags
Importance of Git tags Why using tags ? … yeah, you know it  Why is MORE IMPORTANT in Git than in SVN ? Git commit IDs is SHA-1 hashing (WTF $!#@$!%@^!) Tags = reference to a commit (zero payload) Type of Git tags Lightweight tags (simple Git ref to a commit ID) Annotated tags (author, description, signature)
Lightweight tags Let’s create a lightweight tag … that’s easier to remember than b7dbbe69f0be…. !
Fully annotate tags Fully annotated tags contains meta-data: Timestamp Author name and e-mail Description Commit ID GPG Digital Signature Create your private GPG Key-pair first GPG Public Key identify your user GPG Private Key is used to sign content (tags, commits) Exchange GPG Public Key with your peers
Create GPG Key pair
Create annotated tag Let’s create a fully annotated and signed tag Tags are just Git references
Git remote management
Git nature: peer-to-peer distributed Git designed to be distributed Global unique IDs for files and commits (SHA-1) Completely disconnected operations Rich set of merging capabilities Compression and integrity check Natural way of using it is peer-to-peer … the Linus way, yeah
Remote Git repositories Points to other’s people repository Remote Git servers / location Remote Git branches Example: clone GIT source code repository via “remote” git clone git://git.kernel.org/pub/scm/git/git.git
Inspecting remote pointers List of remote Git repositories Name “origin” refers to remote Git repository List of remote Git branches
Push changes to remote Git repository Add pointer to remote Git repository Push all local branches to remote Git repository
Getting remote Git repository updates Fetching remote changes with git fetch Merge (or rebase) changes
Getting changes: shortcuts Use git pull for merging with remote changesgit pull = git fetch + git merge… beaware of the branches merge mess ! Use git fetch + git rebase with a macro: git updateupdate = !sh -c 'git stash clear && git stash && git fetch origin && git rebase origin/master && git stash pop’git update = git fetch + git rebase… flat and clean history … seems like SVN isn’t it ? 
Git repositories (local/remote) recap
Choosing your Git Server
Public Git Server: github Many choices … but github is the best ! Create your SSH Key-pairssh-keygen -trsa -b 2048 Create your free acount on: https://github.com/signup/free Create your repository on:https://github.com/repositories/new Add your remotegit remote add origin git@github.com:lucamilanesio/33degree.git
Private Git Server: GitEnterprise Many choices … but this is the best for FREE  Create your SSH Key-pair (optional: you can use HTTP/basic auth, firewall frendly)ssh-keygen -trsa -b 2048 Create your free acount on: https://gitent-scm.com/gitent/users/SignUp.git Create your repository on:https://gitent-scm.com/gitent/repository/RepositoryCreation.git Add your remotegit remote add origin ssh://lmilanesio@gitent-scm.com/git/gitentdevelopment/33degree
3rd choice: make your own ! Installed on your network, running on your hardware NOTE: make daily backups … GIT is dangerous ! Gitosis (http://eagain.net/gitweb/?p=gitosis.git) Users / Groups / Keys Repository management Everything managed with Git Management Repository  Gerrit (http://code.google.com/p/gerrit/) Full Web-based Interface Users / Groups integrated with LDAP, OpenID, … Full repository and security management Full code-review lifecycle management
Git collaboration: anarchy
Everybody fetch/pull from each other Anna John Cathy Linus Luke Peter Nobody pushes: everybody fetch or pull Every Git repository has the same importance
How does it work ? Run your own Git server with git daemon Others can clone and fetch from your repository You see them fetching
Git collaboration: dictator and lieutenants
Developers fetch/pull, dictator pushes git push Developers pull, Lieutenants integrate Dictator get integration branches together: he is the only one that PUSH to Git Picture courtesyofProGit.org
GitHub variant git push Developers pull from “blessed” and have their own public Git Integration manager is the Dictator Revolution allowed: developer nominates himself “new dictator” Picture courtesyofProGit.org
Git Democracy
Unique central repository Everybody can push / pull from shared Git Repository Central repository dies  elections of new repository Picture courtesyofProGit.org
Back to centralisation ? WTF ? Does it seems like SVN ? … much more guys  Git Democracy vs. SVN Horizontal collaboration between developers (P2P) Continuous branching / merging “promotions” of changes through voting (Gerrit model) Control over integration / release Does it seems like Git is mature for the Enterprise ?

More Related Content

What's hot

Using Git Inside Eclipse, Pushing/Cloning from GitHub
Using Git Inside Eclipse, Pushing/Cloning from GitHubUsing Git Inside Eclipse, Pushing/Cloning from GitHub
Using Git Inside Eclipse, Pushing/Cloning from GitHubAboutHydrology Slides
 
Gerrit Code Review v3.2 and v3.3
Gerrit Code Review v3.2 and v3.3Gerrit Code Review v3.2 and v3.3
Gerrit Code Review v3.2 and v3.3Luca Milanesio
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)John Anderson
 
Git cheat-sheets
Git cheat-sheetsGit cheat-sheets
Git cheat-sheetsozone777
 
GitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comGitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comB1 Systems GmbH
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14msohn
 
Using Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review ProcessordUsing Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review ProcessordMarc Karasek
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
ESE 2010: Using Git in Eclipse
ESE 2010: Using Git in EclipseESE 2010: Using Git in Eclipse
ESE 2010: Using Git in EclipseChris Aniszczyk
 
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23msohn
 
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GITGhadiAlGhosh
 
Writing Commits for You, Your Friends, and Your Future Self
Writing Commits for You, Your Friends, and Your Future SelfWriting Commits for You, Your Friends, and Your Future Self
Writing Commits for You, Your Friends, and Your Future SelfAll Things Open
 
WTF is GitOps and Why You Should Care?
WTF is GitOps and Why You Should Care?WTF is GitOps and Why You Should Care?
WTF is GitOps and Why You Should Care?Weaveworks
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHubRick Umali
 

What's hot (20)

Using Git Inside Eclipse, Pushing/Cloning from GitHub
Using Git Inside Eclipse, Pushing/Cloning from GitHubUsing Git Inside Eclipse, Pushing/Cloning from GitHub
Using Git Inside Eclipse, Pushing/Cloning from GitHub
 
Git & git hub
Git & git hubGit & git hub
Git & git hub
 
Gerrit Code Review v3.2 and v3.3
Gerrit Code Review v3.2 and v3.3Gerrit Code Review v3.2 and v3.3
Gerrit Code Review v3.2 and v3.3
 
Git kelvin
Git   kelvinGit   kelvin
Git kelvin
 
Git General
Git GeneralGit General
Git General
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)Introduction to Git (even for non-developers!)
Introduction to Git (even for non-developers!)
 
Git cheat-sheets
Git cheat-sheetsGit cheat-sheets
Git cheat-sheets
 
GitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comGitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.com
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
 
Using Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review ProcessordUsing Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review Processord
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
ESE 2010: Using Git in Eclipse
ESE 2010: Using Git in EclipseESE 2010: Using Git in Eclipse
ESE 2010: Using Git in Eclipse
 
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
 
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
 
Writing Commits for You, Your Friends, and Your Future Self
Writing Commits for You, Your Friends, and Your Future SelfWriting Commits for You, Your Friends, and Your Future Self
Writing Commits for You, Your Friends, and Your Future Self
 
WTF is GitOps and Why You Should Care?
WTF is GitOps and Why You Should Care?WTF is GitOps and Why You Should Care?
WTF is GitOps and Why You Should Care?
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Github
GithubGithub
Github
 
GitHub Introduction
GitHub IntroductionGitHub Introduction
GitHub Introduction
 

Viewers also liked

News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26msohn
 
Speed up Continuous Delivery with BigData Analytics
Speed up Continuous Delivery with BigData AnalyticsSpeed up Continuous Delivery with BigData Analytics
Speed up Continuous Delivery with BigData AnalyticsLuca Milanesio
 
Mobile Application Lifecycle with Jekins, Trello and CollabNet TeamForge
Mobile Application Lifecycle with Jekins, Trello and CollabNet TeamForgeMobile Application Lifecycle with Jekins, Trello and CollabNet TeamForge
Mobile Application Lifecycle with Jekins, Trello and CollabNet TeamForgeLuca Milanesio
 
Gerrit Code Review: how to script a plugin with Scala and Groovy
Gerrit Code Review: how to script a plugin with Scala and GroovyGerrit Code Review: how to script a plugin with Scala and Groovy
Gerrit Code Review: how to script a plugin with Scala and GroovyLuca Milanesio
 
Gerrit jenkins-big data-continuous-delivery
Gerrit jenkins-big data-continuous-deliveryGerrit jenkins-big data-continuous-delivery
Gerrit jenkins-big data-continuous-deliveryLuca Milanesio
 
GerritHub.io - present, past, future
GerritHub.io - present, past, futureGerritHub.io - present, past, future
GerritHub.io - present, past, futureLuca Milanesio
 
Devoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery Analytics
Devoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery AnalyticsDevoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery Analytics
Devoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery AnalyticsLuca Milanesio
 
Zero-Downtime Gerrit Code Review Upgrade
Zero-Downtime Gerrit Code Review UpgradeZero-Downtime Gerrit Code Review Upgrade
Zero-Downtime Gerrit Code Review UpgradeLuca Milanesio
 
Jenkins User Conference - Continuous Delivery on Mobile
Jenkins User Conference - Continuous Delivery on MobileJenkins User Conference - Continuous Delivery on Mobile
Jenkins User Conference - Continuous Delivery on MobileLuca Milanesio
 
Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginLuca Milanesio
 
Gerrit Code Review Analytics
Gerrit Code Review AnalyticsGerrit Code Review Analytics
Gerrit Code Review AnalyticsLuca Milanesio
 

Viewers also liked (13)

Gerrit Code Review
Gerrit Code ReviewGerrit Code Review
Gerrit Code Review
 
News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26
 
Speed up Continuous Delivery with BigData Analytics
Speed up Continuous Delivery with BigData AnalyticsSpeed up Continuous Delivery with BigData Analytics
Speed up Continuous Delivery with BigData Analytics
 
Mobile Application Lifecycle with Jekins, Trello and CollabNet TeamForge
Mobile Application Lifecycle with Jekins, Trello and CollabNet TeamForgeMobile Application Lifecycle with Jekins, Trello and CollabNet TeamForge
Mobile Application Lifecycle with Jekins, Trello and CollabNet TeamForge
 
Gerrit Code Review: how to script a plugin with Scala and Groovy
Gerrit Code Review: how to script a plugin with Scala and GroovyGerrit Code Review: how to script a plugin with Scala and Groovy
Gerrit Code Review: how to script a plugin with Scala and Groovy
 
Gerrit jenkins-big data-continuous-delivery
Gerrit jenkins-big data-continuous-deliveryGerrit jenkins-big data-continuous-delivery
Gerrit jenkins-big data-continuous-delivery
 
Is TDD dead or alive?
Is TDD dead or alive?Is TDD dead or alive?
Is TDD dead or alive?
 
GerritHub.io - present, past, future
GerritHub.io - present, past, futureGerritHub.io - present, past, future
GerritHub.io - present, past, future
 
Devoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery Analytics
Devoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery AnalyticsDevoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery Analytics
Devoxx 2016 Using Jenkins, Gerrit and Spark for Continuous Delivery Analytics
 
Zero-Downtime Gerrit Code Review Upgrade
Zero-Downtime Gerrit Code Review UpgradeZero-Downtime Gerrit Code Review Upgrade
Zero-Downtime Gerrit Code Review Upgrade
 
Jenkins User Conference - Continuous Delivery on Mobile
Jenkins User Conference - Continuous Delivery on MobileJenkins User Conference - Continuous Delivery on Mobile
Jenkins User Conference - Continuous Delivery on Mobile
 
Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub plugin
 
Gerrit Code Review Analytics
Gerrit Code Review AnalyticsGerrit Code Review Analytics
Gerrit Code Review Analytics
 

Similar to Git workshop 33degree 2011 krakow

Similar to Git workshop 33degree 2011 krakow (20)

Roslyn on GitHub
Roslyn on GitHubRoslyn on GitHub
Roslyn on GitHub
 
Demystifying git
Demystifying git Demystifying git
Demystifying git
 
Git_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGit_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_Guidewire
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with 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
GitGit
Git
 
Git introduction
Git introductionGit introduction
Git introduction
 
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
 
Git Primer
Git PrimerGit Primer
Git Primer
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
3 Git
3 Git3 Git
3 Git
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 

More from Luca Milanesio

What's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyondWhat's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyondLuca Milanesio
 
Gerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeGerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeLuca Milanesio
 
Cloud-native Gerrit Code Review
Cloud-native Gerrit Code ReviewCloud-native Gerrit Code Review
Cloud-native Gerrit Code ReviewLuca Milanesio
 
Gerrit Code Review migrations step-by-step
Gerrit Code Review migrations step-by-stepGerrit Code Review migrations step-by-step
Gerrit Code Review migrations step-by-stepLuca Milanesio
 
ChronicleMap non-blocking cache for Gerrit v3.3
ChronicleMap non-blocking cache for Gerrit v3.3ChronicleMap non-blocking cache for Gerrit v3.3
ChronicleMap non-blocking cache for Gerrit v3.3Luca Milanesio
 
Gerrit Code Review multi-site
Gerrit Code Review multi-siteGerrit Code Review multi-site
Gerrit Code Review multi-siteLuca Milanesio
 
What's new in Gerrit Code Review 3.0
What's new in Gerrit Code Review 3.0What's new in Gerrit Code Review 3.0
What's new in Gerrit Code Review 3.0Luca Milanesio
 
Gerrit User Summit 2019 Keynote
Gerrit User Summit 2019 KeynoteGerrit User Summit 2019 Keynote
Gerrit User Summit 2019 KeynoteLuca Milanesio
 
Gerrit multi-master / multi-site at GerritHub
Gerrit multi-master / multi-site at GerritHubGerrit multi-master / multi-site at GerritHub
Gerrit multi-master / multi-site at GerritHubLuca Milanesio
 
GerritHub a true Gerrit migration story to v2.15
GerritHub a true Gerrit migration story to v2.15GerritHub a true Gerrit migration story to v2.15
GerritHub a true Gerrit migration story to v2.15Luca Milanesio
 
Gerrit User Summit 2018 - Keynote
Gerrit User Summit 2018 - Keynote Gerrit User Summit 2018 - Keynote
Gerrit User Summit 2018 - Keynote Luca Milanesio
 
Jenkins plugin for Gerrit Code Review pipelines
Jenkins plugin for Gerrit Code Review pipelinesJenkins plugin for Gerrit Code Review pipelines
Jenkins plugin for Gerrit Code Review pipelinesLuca Milanesio
 
Gerrit User Summit 2017 Keynote
Gerrit User Summit 2017 KeynoteGerrit User Summit 2017 Keynote
Gerrit User Summit 2017 KeynoteLuca Milanesio
 
How to keep Jenkins logs forever without performance issues
How to keep Jenkins logs forever without performance issuesHow to keep Jenkins logs forever without performance issues
How to keep Jenkins logs forever without performance issuesLuca Milanesio
 
Jenkins Pipeline on your Local Box to Reduce Cycle Time
Jenkins Pipeline on your Local Box to Reduce Cycle TimeJenkins Pipeline on your Local Box to Reduce Cycle Time
Jenkins Pipeline on your Local Box to Reduce Cycle TimeLuca Milanesio
 
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code ReviewJenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code ReviewLuca Milanesio
 
Stable master workflow with Gerrit Code Review
Stable master workflow with Gerrit Code ReviewStable master workflow with Gerrit Code Review
Stable master workflow with Gerrit Code ReviewLuca Milanesio
 

More from Luca Milanesio (17)

What's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyondWhat's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyond
 
Gerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeGerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source code
 
Cloud-native Gerrit Code Review
Cloud-native Gerrit Code ReviewCloud-native Gerrit Code Review
Cloud-native Gerrit Code Review
 
Gerrit Code Review migrations step-by-step
Gerrit Code Review migrations step-by-stepGerrit Code Review migrations step-by-step
Gerrit Code Review migrations step-by-step
 
ChronicleMap non-blocking cache for Gerrit v3.3
ChronicleMap non-blocking cache for Gerrit v3.3ChronicleMap non-blocking cache for Gerrit v3.3
ChronicleMap non-blocking cache for Gerrit v3.3
 
Gerrit Code Review multi-site
Gerrit Code Review multi-siteGerrit Code Review multi-site
Gerrit Code Review multi-site
 
What's new in Gerrit Code Review 3.0
What's new in Gerrit Code Review 3.0What's new in Gerrit Code Review 3.0
What's new in Gerrit Code Review 3.0
 
Gerrit User Summit 2019 Keynote
Gerrit User Summit 2019 KeynoteGerrit User Summit 2019 Keynote
Gerrit User Summit 2019 Keynote
 
Gerrit multi-master / multi-site at GerritHub
Gerrit multi-master / multi-site at GerritHubGerrit multi-master / multi-site at GerritHub
Gerrit multi-master / multi-site at GerritHub
 
GerritHub a true Gerrit migration story to v2.15
GerritHub a true Gerrit migration story to v2.15GerritHub a true Gerrit migration story to v2.15
GerritHub a true Gerrit migration story to v2.15
 
Gerrit User Summit 2018 - Keynote
Gerrit User Summit 2018 - Keynote Gerrit User Summit 2018 - Keynote
Gerrit User Summit 2018 - Keynote
 
Jenkins plugin for Gerrit Code Review pipelines
Jenkins plugin for Gerrit Code Review pipelinesJenkins plugin for Gerrit Code Review pipelines
Jenkins plugin for Gerrit Code Review pipelines
 
Gerrit User Summit 2017 Keynote
Gerrit User Summit 2017 KeynoteGerrit User Summit 2017 Keynote
Gerrit User Summit 2017 Keynote
 
How to keep Jenkins logs forever without performance issues
How to keep Jenkins logs forever without performance issuesHow to keep Jenkins logs forever without performance issues
How to keep Jenkins logs forever without performance issues
 
Jenkins Pipeline on your Local Box to Reduce Cycle Time
Jenkins Pipeline on your Local Box to Reduce Cycle TimeJenkins Pipeline on your Local Box to Reduce Cycle Time
Jenkins Pipeline on your Local Box to Reduce Cycle Time
 
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code ReviewJenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review
 
Stable master workflow with Gerrit Code Review
Stable master workflow with Gerrit Code ReviewStable master workflow with Gerrit Code Review
Stable master workflow with Gerrit Code Review
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Recently uploaded (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Git workshop 33degree 2011 krakow

  • 1. Git Luca Milanesio Android programming Sang Shin The Productive Programmer Neal Ford The Power of Retrospection Linda Rising Introduction to Scala Hubert Plociniczak Main sponsor
  • 2. Agenda SCM and Git Concepts Git quick start Branching and merging Resolving conflicts Reverting changes Working with tags Git remotes Git on the server Git peer-to-peer Git democracy
  • 3. Who’s that guy ? Luca MilanesioLMIT Limited – Director / co-founder of GitEnterprise.com Jenkins (formerly Hudson) contributor since 2007founder of hudson-mobi.com Over 18 years of experience in Software and Services Development and Application Lifecycle Worked for major UK, EU and US Customers Banking, Retailers, Industry, Finance, Telecoms, Utilities, Government Git enthusiast since 2009 and innovator in Vodafone Group Services Ltd
  • 4.
  • 8. Manage branches of development
  • 9. Integrate the work of multiple teams together
  • 10. … and much more Picture courtesyofglobalnerdy.com - Allrightskindlyreserved
  • 11. Brief history of OpenSourceSCMs Local SCMs (versions kept on local filesystem) SCCS (1972) … I was not yet born, don’t remember  RCS (1982) the most widely used on Unix Server-based SCMs (central repository server) CVS (1990) first widely used SCM server Subversion (2000) first widely Internet SCM … and then let’s to go distributed … DCVS (2002) who has ever used it ? Mercurial and Git (2005)
  • 12. Centralised vs. distributed ? How many of you are using central repositories ? CVS-boys … raise your hands ! SVN-guys … it’s your turn ! How many are for distributed repositories ? Mercurial-scientists ... raise your hands ! Git-explorers … brave men !
  • 13. Who’s right ? Central SCM Unique “source of truth” Central back-up Seamless alignment for all developers Security and access control Distributed SCM Community code-base No single-point-of-failure Peer-to-peer alignment Continuous branching and merging
  • 14. Why GIT ? It’s all about BitKeeper fault: they broke up with LinusTorvalds … and I’m not kidding  Story: Linux Kernel SCM: BitKeeper Apr 2005 – Linus writes PERL scripts for Linux Kernel SCM Jul 2005 … Git 0.99 is out ! Git principles: Allow the BitKeeper SCM workflow Use CVS as the “not-to-do” example Check and prevent corruption Make it FFF … FAST FAST FAST !
  • 15. BORED of too much theory ?
  • 17. Git installation (Ver. >=1.6) Linux (Gitfavourite of course !) Ubuntu: sudo apt-get install git-core other Linux ? … best from source codehttp://git-scm.com/ Mac OSX http://code.google.com/p/git-osx-installer/ Windows http://code.google.com/p/msysgit/(sucks … but it’s your fault not using Unix) CygwinHIGHLY RECOMMENDED (mandatory IMHO)
  • 18.
  • 20.
  • 22.
  • 23. Add to GIT (default = recursive)
  • 24.
  • 25.
  • 26. State 1. unstaged Create a new file Change an existing file Check status
  • 27. State 2. staged Add the two files to staging area Check status
  • 28. State 3. work directory clean Commit the staging area Check status
  • 29. Display Git lifecycle Add another file and make some changes $ gitgui
  • 30. Stage with gitgui Select files and chose “Stage to commit”
  • 31. Commit with gitgui Enter commit message and click “commit”
  • 32. Git graph log with gitk
  • 34. Git stores the whole file Git is different from SVN: no diffs, just whole files Git stores changed files between snapshots(BitKeeperdocet) Picture courtesyofProGit.org
  • 35. Git object types: blobs Git stores all files (and their versions) as objects (blobs) Each object has a SHA-1 160-bit identifier SHA-1 provides: Unique Global ID Integrity check Example: File content: “You're GIT too” SHA-1: bbecf72783dfba9e0243e13dbb5fb04ed39ed4e4 (Hex) Track content (not files) Automatically detect renames … cool !
  • 36. SHA-1 ? WTF … Why LinusTorvalds has chosen SHA-1 hashing ? Need for track content globally SHA-1 collision probability is 1/251 What happens if two files have same SHA-1 ? BOOM ! What is the probability of it ? World’s population (7 BN people)sharing files of 10 times Linux Kernel Possible ? More likely to be hit by a 15 KM asteroid NOW !!!
  • 37. Git object types: commits and trees Git tree identifies a snapshot (set of files) Git commit identifies Author / Committer Commit message Timestamp Tree Picture courtesyofProGit.org
  • 38. Git history: graph of commits Every commit points to its predecessor Series of commits make Git repository history Picture courtesyofProGit.org
  • 39. Where are Git objects ? Git objects are in .git/objects SHA-1 identify directory / file
  • 40. Curious about Git objects ? Git objects are compressed Use git show to display content
  • 41. Getting lost ? How to remember SHA-1 hashing codes ? How Git stores the “pointers” to Commit graph ? Git references are the solution ! Head of the Git history Intermediate tags Branch points Relative points
  • 42. Git references References: “labels” for Git SHA-1 commit IDs Stored as files under .git/refs Reference types: Tags Heads (branches) HEAD is a special ref:always points tohead of currentbranch.
  • 43. How Git commits graph looks like ? Reference Commit Tree Picture courtesyofProGit.org
  • 44. What is a branch for Git ? Git named branch = reference to a commit ID (head of branch) Git supports “network” of commits, with named and unnamed branches … don’t know why Git reminds me some “underground” branches 
  • 45. Real-life Git branches Think I’m exaggerating ? Look at this example (it’s real, swear !)
  • 46. Let’s practice on Git branches !
  • 47. Wear “life jacket” first Get Git bash extensions source git/contrib/completion/git-completion.bash Redefine promptexport PS1='$(__git_ps1 " (%s)") ’ ... and your current branch is visible on your prompt: you will not get lost 
  • 48. Creating branches Create branch  create a new ref to current commit
  • 49. Switching branch Use git checkout to switch branch Current displayed branch changed to experimental Note that HEAD points to experimental
  • 50. Commit on branch Add a new commit to experimental branch See the new branch graph (gitk)
  • 51. Merge When experiments are completed … merge back ! Checkout master Merge experimental
  • 52. Git graph after merge Let’s have a look on the result with gitk Merge-type applied: Fast-forward (move refs in history) Branch has been “flattened” Experimental just another ref to master
  • 53. Git recursive-merge Let’s create some divergence Changes on both master and experimental Fast-forward merge = move branch ref to another commit ID
  • 54. Git diverging branches Use gitk --all to display all branchesNOTE: no args displays just current branch experimental is really diverging from master
  • 55. Git recursive merge Let’s merge again with master This is a real merge folks ! NOTE: Merge is a Git commit: you can associate a comment, or revert it later ! Don’t be scared by Git-managed merge 
  • 56. Merge alternatives: rebase Picture courtesyofProGit.org
  • 57. Git rebase in action Let’s diverge again between master and experimental Magic ! … rebase flattens the branching history
  • 58. Git graph after rebase Experimental is no more a diverging branch NOTE: Marconi’s test is on “unnamed branch” and experimental branch history has changed !
  • 59. Merge alternatives: squash origin C1 C2 C3 C4 C5 C6 C1 C2 C3 C4 C3 C4 C3’+C4’ mywork origin mywork
  • 60. Git squash in action Get branch changes but do not join them git merge –squash experimentalcommit
  • 61. Git branch graph after squash Branches are still diverging Get all the branch changes in a single commit(squash changes together)
  • 62. Merge alternatives: cherry-pick origin C1 C2 C3 C4 C5 C6 C1 C2 C3 C4 C5 C6 C6’ mywork origin mywork
  • 63. Merge alternatives: cherry-pick Get individual commit IDs Apply individual changes to another branch
  • 64. Git branch graph after cherry-pick Individual commit has been copied from tesla-test Both branches are kept
  • 65. Too easy ? … let’s create some conflict !
  • 66. Merge conflict Same file changed, same range, two different branches
  • 67. Resolving conflict Get list of conflicts with git status Display and edit conflicted file
  • 68. Completing merge Add edited file to stage Commit and finalise the merged commit … wasn’t that scary isn’t it ? 
  • 69. Rebase / cherry-pick conflict Same file changed, same range, two different branches
  • 70. Don’t panic … unnamed branch Check in which branch you are Check files in conflict
  • 71. Resolve conflict and continue rebase Resolve conflicts Continue rebase
  • 72. Got lost with commands, merge and conflicts ?
  • 75. Git is powerful and dangerous Git has full control on history Amend existing commits Remove commits Revert changes Be careful: you could destroy your history ! Be even more careful: history revert is unrecoverable SCARY !!!!!
  • 76. Change existing commits Git commit support the “amend” option to overwrite committed data What can be amended File changes Author / comment Date The original commit will disappear: amend is NOT revertible (but just amended again)
  • 77. Amend last commit Let’s display the last commit on master
  • 78. Amend last commit Let’s change commit content
  • 79. Git reset: back to the past Git reset allows to: Put committed data back to the working dir  soft reset Remove completely committed data  hard reset Git reset is NOT revertible You want to reset ? Do you really need it ? Do you really want it ? What do you want to achieve ? … and then think again …
  • 80. Soft reset Remove the last commit and put changes back to workdir Hint: master~1 = reference to “one commit before master head” Commit is lost, but you still have the changes in workdir
  • 81. Hard reset Remove commit and all the changes associated Commit is lostFOREVER: there is no way to restore the data
  • 82. Git revert Git revert allows to: Revert the changes and to workdir Revert the changes and create a “reverted commit” Git revert is revertible Revert = negative commit (eliminates effect of reverted commit)
  • 83. Display last commit Let’s display the last commit changes on master
  • 84. Create reverted commit Let’s revert last commit
  • 85. Now: how to revert the revert ? Reverted commit is a commit Use reset to eliminate the revert operation
  • 87. Importance of Git tags Why using tags ? … yeah, you know it  Why is MORE IMPORTANT in Git than in SVN ? Git commit IDs is SHA-1 hashing (WTF $!#@$!%@^!) Tags = reference to a commit (zero payload) Type of Git tags Lightweight tags (simple Git ref to a commit ID) Annotated tags (author, description, signature)
  • 88. Lightweight tags Let’s create a lightweight tag … that’s easier to remember than b7dbbe69f0be…. !
  • 89. Fully annotate tags Fully annotated tags contains meta-data: Timestamp Author name and e-mail Description Commit ID GPG Digital Signature Create your private GPG Key-pair first GPG Public Key identify your user GPG Private Key is used to sign content (tags, commits) Exchange GPG Public Key with your peers
  • 91. Create annotated tag Let’s create a fully annotated and signed tag Tags are just Git references
  • 93. Git nature: peer-to-peer distributed Git designed to be distributed Global unique IDs for files and commits (SHA-1) Completely disconnected operations Rich set of merging capabilities Compression and integrity check Natural way of using it is peer-to-peer … the Linus way, yeah
  • 94. Remote Git repositories Points to other’s people repository Remote Git servers / location Remote Git branches Example: clone GIT source code repository via “remote” git clone git://git.kernel.org/pub/scm/git/git.git
  • 95. Inspecting remote pointers List of remote Git repositories Name “origin” refers to remote Git repository List of remote Git branches
  • 96. Push changes to remote Git repository Add pointer to remote Git repository Push all local branches to remote Git repository
  • 97. Getting remote Git repository updates Fetching remote changes with git fetch Merge (or rebase) changes
  • 98. Getting changes: shortcuts Use git pull for merging with remote changesgit pull = git fetch + git merge… beaware of the branches merge mess ! Use git fetch + git rebase with a macro: git updateupdate = !sh -c 'git stash clear && git stash && git fetch origin && git rebase origin/master && git stash pop’git update = git fetch + git rebase… flat and clean history … seems like SVN isn’t it ? 
  • 100. Choosing your Git Server
  • 101. Public Git Server: github Many choices … but github is the best ! Create your SSH Key-pairssh-keygen -trsa -b 2048 Create your free acount on: https://github.com/signup/free Create your repository on:https://github.com/repositories/new Add your remotegit remote add origin git@github.com:lucamilanesio/33degree.git
  • 102. Private Git Server: GitEnterprise Many choices … but this is the best for FREE  Create your SSH Key-pair (optional: you can use HTTP/basic auth, firewall frendly)ssh-keygen -trsa -b 2048 Create your free acount on: https://gitent-scm.com/gitent/users/SignUp.git Create your repository on:https://gitent-scm.com/gitent/repository/RepositoryCreation.git Add your remotegit remote add origin ssh://lmilanesio@gitent-scm.com/git/gitentdevelopment/33degree
  • 103. 3rd choice: make your own ! Installed on your network, running on your hardware NOTE: make daily backups … GIT is dangerous ! Gitosis (http://eagain.net/gitweb/?p=gitosis.git) Users / Groups / Keys Repository management Everything managed with Git Management Repository  Gerrit (http://code.google.com/p/gerrit/) Full Web-based Interface Users / Groups integrated with LDAP, OpenID, … Full repository and security management Full code-review lifecycle management
  • 105. Everybody fetch/pull from each other Anna John Cathy Linus Luke Peter Nobody pushes: everybody fetch or pull Every Git repository has the same importance
  • 106. How does it work ? Run your own Git server with git daemon Others can clone and fetch from your repository You see them fetching
  • 107. Git collaboration: dictator and lieutenants
  • 108. Developers fetch/pull, dictator pushes git push Developers pull, Lieutenants integrate Dictator get integration branches together: he is the only one that PUSH to Git Picture courtesyofProGit.org
  • 109. GitHub variant git push Developers pull from “blessed” and have their own public Git Integration manager is the Dictator Revolution allowed: developer nominates himself “new dictator” Picture courtesyofProGit.org
  • 111. Unique central repository Everybody can push / pull from shared Git Repository Central repository dies  elections of new repository Picture courtesyofProGit.org
  • 112. Back to centralisation ? WTF ? Does it seems like SVN ? … much more guys  Git Democracy vs. SVN Horizontal collaboration between developers (P2P) Continuous branching / merging “promotions” of changes through voting (Gerrit model) Control over integration / release Does it seems like Git is mature for the Enterprise ?
  • 113. Git branching model Picture courtesyofProGit.org
  • 114. Working with topic branches Developers work on topics Code-review / votes promote them to master Topics branches removed after merge NOTE: better rebase than merge Picture courtesyofProGit.org
  • 115. Topic branches example Developer A starts working on topic-1 Developer B starts working on topic-2
  • 116. Code-review: merge topic-1 Get topic-1 code and code-review on integration branch Everything’s fine: commit the merge and remove topic-1
  • 117. Code-review: merge topic-2 Repeat the same with topic-2
  • 118. Release manager: merge integration Release manager decides about releasing integration branch NOTE: No conflicts are generated  all merges are from integration branch
  • 119.
  • 120.
  • 121.
  • 122. BOF: Hack your company Jakub Nabrdalik BOF: Web framework shootout Błażej Bucko, Tomasz Dziurko, Wojciech Erbetowski, Łukasz Kuczera, Paweł Szulc BOF: Future of Java EE Alexis Moussine-Pouchkine BOF: Those broken, broken class loaders JevgeniKabanov Main sponsor