SlideShare a Scribd company logo
1 of 43
The everyday developer’s
guide to version
control with git
so, what’s git?
“   Git is distributed version control system
    focused on speed, effectivity and real-
    world usability on large projects.
                                    - git-scm.com
basic source control system (example)




       http://hoth.entp.com/output/git_for_designers.html
but why git?
lots of people use it (it’s common)




          http://en.wikipedia.org/wiki/Git_(software)
let’s git started
create (initialize) a repository


  $ cd (project-directory)
  $ git init
  Initialized empty Git repository in .git/
your first save (commit)


 $ git commit -m 'Initial commit'
create some files


 $ touch README
see what’s changed


 $ git status
 # On branch master
 #
 # Initial commit
 #
 # Untracked files:
 #   (use "git add <file>..." to include in what will be committed)
 #
 # README
 nothing added to commit but untracked files present (use "git add" to
 track)
adding files

 Adding a individual file
 $ git add README




 Adding a multiple files
 $ git add .
see what’s changed (again)


 $ git status
 #   On branch master
 #
 #   Initial commit
 #
 #   Changes to be committed:
 #     (use "git rm --cached <file>..." to unstage)
 #
 #   new file: README
 #
save (commit) your changes


 $ git commit -m 'Added README file'
 Created initial commit c1195b5: Added README file
  0 files changed, 0 insertions(+), 0 deletions(-)
  create mode 100644 README
check your history


 $ git log

 commit c1195b51d6e99dcc6e88b6ae44eea20ba1f0868e
 Author: Erin Carter <me@erincarter.com>
 Date:   Thu Oct 29 12:21:24 2009 -0500

    Added README file
developing with git
undoing your changes


 $ git checkout README
reverting to specific version


 $ git checkout
 3607253d20c7a295965f798109f9d4af0fbeedd8 <file name>
reverting back


 $ git reset HEAD <file name>
developing parallel with branching




       http://hoth.entp.com/output/git_for_designers.html
create a branch


 $ git checkout -b bugfix

 Switched to a new branch “bugfix”
switching branches


 $ git status

 # On branch bugfix
 nothing to commit (working directory clean)

 $ git checkout master

 Switched to branch “master”
collaborating with git
public repos = free
            private repos = cheap



http://github.com
clone a hosted repository


 $ git clone git://github.com/git/hello-
 world.git
 Initialized empty Git repository in /Users/me/Projects/hello-
 world/.git/
 remote: Counting objects: 158, done.
 remote: Compressing objects: 100% (79/79), done.
 remote: Total 158 (delta 54), reused 157 (delta 54)
 Receiving objects: 100% (158/158), 15.62 KiB, done.
 Resolving deltas: 100% (54/54), done.


 $ cd hello-world
pull changes (and pull often)


 $ git pull origin master
add changes to master


 $ git checkout master

 $ git merge bugfix
push changes


 $ git push origin master
configure & customize git
configuring


 $ git config --global user.name "Erin Carter"
 $ git config --global user.email "me@erincarter.com"
add pretty colors


 $ git config --global color.diff auto
 $ git config --global color.status auto
 $ git config --global color.branch auto
git tools
gitk




       usually comes with git - http://gitk.sourceforge.net/
GitX




       http://gitx.frim.nl
TortoiseGit




       http://code.google.com/p/tortoisegit/
git resources
Pro Git (book)




       free online at http://progit.org/book/
Pragmatic Version Control Using Git (book)




 http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git
Git Community Book




        http://book.git-scm.com/
Git Cheat Sheet




  http://ktown.kde.org/~zrusin/git/git-cheat-sheet-large.png
what to remember


  ‣   commit often
  ‣   pull often
  ‣   use checkout and reset with caution
  ‣   create your own repository anywhere


        http://hoth.entp.com/output/git_for_designers.html
fin
@erincarter
me@erincarter.com
linkedin.com/in/erincarter



illustrations by Simon Oxley of idokungfood.com
theme inspired by Scott Chacon’s git-scm.com

More Related Content

What's hot

What's hot (20)

Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
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
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Git basics
Git basicsGit basics
Git basics
 
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
 
Github basics
Github basicsGithub basics
Github basics
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git
GitGit
Git
 
Git Rebase vs Merge
Git Rebase vs MergeGit Rebase vs Merge
Git Rebase vs Merge
 

Viewers also liked

Introduction to Version Control System for Windows
Introduction to Version Control System for WindowsIntroduction to Version Control System for Windows
Introduction to Version Control System for Windows
Peter Chang
 
01 - Introduction to Version Control
01 - Introduction to Version Control01 - Introduction to Version Control
01 - Introduction to Version Control
Sergii Shmarkatiuk
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
Mediacurrent
 

Viewers also liked (20)

Version Control System
Version Control SystemVersion Control System
Version Control System
 
What is version control software and why do you need it?
What is version control software and why do you need it?What is version control software and why do you need it?
What is version control software and why do you need it?
 
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
 
Git Tutorial 教學
Git Tutorial 教學Git Tutorial 教學
Git Tutorial 教學
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
Intro To Version Control
Intro To Version ControlIntro To Version Control
Intro To Version Control
 
An introduction to Version Control Systems
An introduction to Version Control SystemsAn introduction to Version Control Systems
An introduction to Version Control Systems
 
Introduction to Version Control System for Windows
Introduction to Version Control System for WindowsIntroduction to Version Control System for Windows
Introduction to Version Control System for Windows
 
Version Control Systems - ArabNet Beirut 2014 - Dani Arnaout
Version Control Systems - ArabNet Beirut 2014 - Dani ArnaoutVersion Control Systems - ArabNet Beirut 2014 - Dani Arnaout
Version Control Systems - ArabNet Beirut 2014 - Dani Arnaout
 
Distributed Version Control (DVCS) With Mercurial
Distributed Version Control (DVCS) With MercurialDistributed Version Control (DVCS) With Mercurial
Distributed Version Control (DVCS) With Mercurial
 
Version control
Version controlVersion control
Version control
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
01 - Introduction to Version Control
01 - Introduction to Version Control01 - Introduction to Version Control
01 - Introduction to Version Control
 
A brief introduction to version control systems
A brief introduction to version control systemsA brief introduction to version control systems
A brief introduction to version control systems
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
Customer Driven Requirements
Customer Driven RequirementsCustomer Driven Requirements
Customer Driven Requirements
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Agile Management for business
Agile Management for businessAgile Management for business
Agile Management for business
 
Version Control with SVN
Version Control with SVNVersion Control with SVN
Version Control with SVN
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 

Similar to The everyday developer's guide to version control with Git

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
Brian K. Vagnini
 

Similar to The everyday developer's guide to version control with Git (20)

Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Git github
Git githubGit github
Git github
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git101
Git101Git101
Git101
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Gittalk
GittalkGittalk
Gittalk
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git Memento of basic commands
Git Memento of basic commandsGit Memento of basic commands
Git Memento of basic commands
 
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 setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
 
GitSetupLinux
GitSetupLinuxGitSetupLinux
GitSetupLinux
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git
GitGit
Git
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

The everyday developer's guide to version control with Git