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)

Introduction git
Introduction gitIntroduction git
Introduction git
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version Control
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
git and github
git and githubgit and github
git and github
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 

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
 
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
 
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
 

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

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

The everyday developer's guide to version control with Git