SlideShare a Scribd company logo
1 of 44
Download to read offline
Git
Kornel Lugosi
 @Coornail


May 17, 2011
Table of contents
Version control
Distributed revision control
Repository
Adding, commiting
Tracking changes
Branches
Pushing, pulling
Submodules
Ranges and other identifications of hashes
Other fun stuff
Resources
Version control




  What?
Version control


   Why?
Version control


                Why?
◮   Backup
Version control


                   Why?
◮   Backup
◮   Revision handling
Version control


                   Why?
◮   Backup
◮   Revision handling
◮   Teamwork
Version control


                 Why?
◮   Backup
◮   Revision handling
◮   Teamwork
◮   Organized code commit access and workflow
Version control


                 Why?
◮   Backup
◮   Revision handling
◮   Teamwork
◮   Organized code commit access and workflow
◮   Deploying
Version control


   How?
Version control


             How?
◮   CVS
Version control


             How?
◮   CVS
◮   SVN
Version control


                    How?
◮   CVS
◮   SVN
◮   Hg(Mercurial)
Version control


                    How?
◮   CVS
◮   SVN
◮   Hg(Mercurial)
◮   bzr (Bazaar)
Version control


                    How?
◮   CVS
◮   SVN
◮   Hg(Mercurial)
◮   bzr (Bazaar)
◮   ...
Version control


                    How?
◮   CVS
◮   SVN
◮   Hg(Mercurial)
◮   bzr (Bazaar)
◮   ...
◮   Git
Distributed revision
       control
Repository




(Repo)
Repository



$ git init
Repository



$ git init

$ git init --bare
Repository



$ git init

$ git init --bare

$ git init --bare --shared=group
Let’s put some code in!

$ echo "some code" > index.php
$ git add index.php
Let’s put some code in!

$ echo "some code" > index.php
$ git add index.php

Oh shit, it is only added to the “index“!
Let’s put some code in!

$ echo "some code" > index.php
$ git add index.php

Oh shit, it is only added to the “index“!
Well, fuck that!

$ git commit -m "My first commit"
Let’s put some code in!

$ echo "some code" > index.php
$ git add index.php

Oh shit, it is only added to the “index“!
Well, fuck that!

$ git commit -m "My first commit"

But it is not on the remote server yet!

$ git push ...
Nobody is looking, let’s commit
           everything!


$ cat > index.php
<?php
   Thousand lines of code
...
ˆD
$ git commit -a
What the hell did I do?




   (in the working tree)
$ git diff
What the hell did I do a year ago?




$ git log
I have no idea what I do



    Let’s not show it to
      everyone (yet)!
$ git branch experimental
$ git checkout experimental
What branch am I on?




$ git branch -a
Turns out I am smart after all




$ git checkout master
$ git merge experimental
I was smart today



Let’s show it to everyone
$ git push <repository> <refspec>
I was smart today



 Let’s show it to everyone
$ git push <repository> <refspec>

Damn! Somebody was faster...
Conflict =(
My code, let me show it to you!


$ git clone <repository>
My code, let me show it to you!


$ git clone <repository>

Okay, I already have you repo, I want to laugh at
your code!

boss$ git pull <repository>
Tagging




$ git tag
Submodules
Submodules


$ git submodule add <repository>
    <path>
Submodules


$ git submodule add <repository>
    <path>


 From the root directory!
Ranges



$ git log 0af56ffa..HEAD
Ranges



$ git log 0af56ffa..HEAD

$ git diff v2.5..HEADˆ
Ranges



$ git log 0af56ffa..HEAD

$ git diff v2.5..HEADˆ

$ git cherry-pick HEAD˜4..
Other fun stuff


◮   $   git   revert
◮   $   git   reset
◮   $   git   stash
◮   $   git   bisect
◮   $   git   rebase
◮   $   git   gc
Links



◮   Official git documentation
◮   github
◮   Git Cheat sheet

More Related Content

What's hot

plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6Nobuo Danjou
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL TigerAkihiro Okuno
 
Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6trexy
 
CPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolsCPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolscharsbar
 
Tdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyTdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyFabio Akita
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Puppet
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With GitHoffman Lab
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemTommaso Visconti
 
Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsth507
 
Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)Chef Software, Inc.
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHubJames Gray
 
Productivity tips for developers
Productivity tips for developersProductivity tips for developers
Productivity tips for developersSebastian Witowski
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshellalignan
 
DevOps in PHP environment
DevOps in PHP environmentDevOps in PHP environment
DevOps in PHP environmentEvaldo Felipe
 

What's hot (20)

plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger
 
Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6
 
Basic Git
Basic GitBasic Git
Basic Git
 
CPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolsCPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its tools
 
Tdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyTdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema Ruby
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
 
Github
GithubGithub
Github
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With Git
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
 
Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commands
 
Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)
 
Git101
Git101Git101
Git101
 
Modern Perl Toolchain
Modern Perl ToolchainModern Perl Toolchain
Modern Perl Toolchain
 
Git internals
Git internalsGit internals
Git internals
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Productivity tips for developers
Productivity tips for developersProductivity tips for developers
Productivity tips for developers
 
Laravel Day / Deploy
Laravel Day / DeployLaravel Day / Deploy
Laravel Day / Deploy
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
DevOps in PHP environment
DevOps in PHP environmentDevOps in PHP environment
DevOps in PHP environment
 

Viewers also liked (7)

Amazon web services
Amazon web servicesAmazon web services
Amazon web services
 
Drupal Performance
Drupal PerformanceDrupal Performance
Drupal Performance
 
Fuctions of GIT
Fuctions of GITFuctions of GIT
Fuctions of GIT
 
Version control
Version controlVersion control
Version control
 
One Gateway for All Kinds of Payments—the Payflow Integration
One Gateway for All Kinds of Payments—the Payflow IntegrationOne Gateway for All Kinds of Payments—the Payflow Integration
One Gateway for All Kinds of Payments—the Payflow Integration
 
VinMORE Live Chat Instructions
VinMORE Live Chat InstructionsVinMORE Live Chat Instructions
VinMORE Live Chat Instructions
 
Drupal Performance
Drupal PerformanceDrupal Performance
Drupal Performance
 

Similar to Git introduction

Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciAtlassian
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in UnityRifauddin Tsalitsy
 
Why Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysWhy Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysCarlos Taborda
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSMatthew McCullough
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSMatthew McCullough
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitRick Umali
 
Simple SQL Change Management with Sqitch
Simple SQL Change Management with SqitchSimple SQL Change Management with Sqitch
Simple SQL Change Management with SqitchDavid Wheeler
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdfAliaaTarek5
 

Similar to Git introduction (20)

Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Github basics
Github basicsGithub basics
Github basics
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git
GitGit
Git
 
Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola Paolucci
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Git Going with DVCS v1.6.0
Git Going with DVCS v1.6.0Git Going with DVCS v1.6.0
Git Going with DVCS v1.6.0
 
Why Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysWhy Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anyways
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCS
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCS
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Simple SQL Change Management with Sqitch
Simple SQL Change Management with SqitchSimple SQL Change Management with Sqitch
Simple SQL Change Management with Sqitch
 
Git Going With DVCS v1.5.2
Git Going With DVCS v1.5.2Git Going With DVCS v1.5.2
Git Going With DVCS v1.5.2
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
 
Git
GitGit
Git
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
 

Recently uploaded

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
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
 

Recently uploaded (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
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
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
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
 

Git introduction