SlideShare a Scribd company logo
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

PDF
Git::Hooks
KEY
Crafting Beautiful CLI Applications in Ruby
PPTX
Deployment Patterns in the Ruby on Rails World
PDF
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
PDF
Cook like a Chef
PDF
Hello git
ODP
Nigel hamilton-megameet-2013
PPTX
Get going with_git_ppt
Git::Hooks
Crafting Beautiful CLI Applications in Ruby
Deployment Patterns in the Ruby on Rails World
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Cook like a Chef
Hello git
Nigel hamilton-megameet-2013
Get going with_git_ppt

What's hot (20)

KEY
plackdo, plack-like web interface on perl6
PDF
2010/7/31 LTの虎@LL Tiger
PPTX
Joy of Six - Discover the Joy of Perl 6
KEY
Basic Git
PDF
CPANTS: Kwalitative website and its tools
PDF
Tdc 2013 - Ecossistema Ruby
PDF
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
PPTX
PPTX
Get Good With Git
PDF
GIT: Content-addressable filesystem and Version Control System
PDF
Git: An introduction of plumbing and porcelain commands
PDF
Cookbook refactoring & abstracting logic to Ruby(gems)
PDF
Modern Perl Toolchain
PDF
Git internals
KEY
Git and GitHub
PDF
Productivity tips for developers
PPTX
Laravel Day / Deploy
PPTX
GIT in a nutshell
PDF
DevOps in PHP environment
PDF
PHP 机智问答
plackdo, plack-like web interface on perl6
2010/7/31 LTの虎@LL Tiger
Joy of Six - Discover the Joy of Perl 6
Basic Git
CPANTS: Kwalitative website and its tools
Tdc 2013 - Ecossistema Ruby
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Get Good With Git
GIT: Content-addressable filesystem and Version Control System
Git: An introduction of plumbing and porcelain commands
Cookbook refactoring & abstracting logic to Ruby(gems)
Modern Perl Toolchain
Git internals
Git and GitHub
Productivity tips for developers
Laravel Day / Deploy
GIT in a nutshell
DevOps in PHP environment
PHP 机智问答
Ad

Viewers also liked (7)

ODP
Amazon web services
PDF
Drupal Performance
PPTX
Fuctions of GIT
PDF
Version control
PPT
One Gateway for All Kinds of Payments—the Payflow Integration
PDF
VinMORE Live Chat Instructions
ODP
Drupal Performance
Amazon web services
Drupal Performance
Fuctions of GIT
Version control
One Gateway for All Kinds of Payments—the Payflow Integration
VinMORE Live Chat Instructions
Drupal Performance
Ad

Similar to Git introduction (20)

PDF
Git Started With Git
PPT
Git presentation
KEY
Git Tech Talk
PDF
Github - Git Training Slides: Foundations
PPTX
Github basics
KEY
Git Distributed Version Control System
PPTX
PDF
Becoming a Git Master - Nicola Paolucci
PPTX
Working in Team using Git in Unity
PDF
Git Going with DVCS v1.6.0
PDF
Why Git Sucks and you'll use it anyways
PDF
Git - Intro to the Basics of DVCS
PDF
Git - Intro to the Basics of DVCS
PDF
Introduction to Git
KEY
Simple SQL Change Management with Sqitch
PDF
Git Going With DVCS v1.5.2
KEY
Working with Git
PPTX
Git like a pro EDD18 - Full edition
PDF
Git_tutorial.pdf
Git Started With Git
Git presentation
Git Tech Talk
Github - Git Training Slides: Foundations
Github basics
Git Distributed Version Control System
Becoming a Git Master - Nicola Paolucci
Working in Team using Git in Unity
Git Going with DVCS v1.6.0
Why Git Sucks and you'll use it anyways
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCS
Introduction to Git
Simple SQL Change Management with Sqitch
Git Going With DVCS v1.5.2
Working with Git
Git like a pro EDD18 - Full edition
Git_tutorial.pdf

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Electronic commerce courselecture one. Pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
Agricultural_Statistics_at_a_Glance_2022_0.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
Electronic commerce courselecture one. Pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Monthly Chronicles - July 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
NewMind AI Weekly Chronicles - August'25 Week I
Building Integrated photovoltaic BIPV_UPV.pdf

Git introduction