SlideShare a Scribd company logo
git started with git
      Nick Quaranto
       nick@quaran.to
       NH.rb April 2009
whoami
• 5th year Software Engineering Major at RIT
• Intern at Thoughtbot
• Blogger at
 • http://github.com/blog
 • http://gitready.com
 • http://litanyagainstfear.com
git pull origin slides

http://drop.io/gitstarted
what’s in store
• ok, no more puns
• i’m a ruby developer, not a kernel hacker
• history lesson
• concepts and principles
• basic workflow
what is git?
“Git is a free distributed revision control, or
software source code management project
with an emphasis on being fast.”


http://en.wikipedia.org/wiki/Git_(software)
actually,


git is a stupid content tracker.
git’s history

• Originally created to handle Linux kernel
  development
• Everything else sucked.
• Now used by plenty of other projects and
  web frameworks that don’t scale
design motives

• Do exactly the opposite of CVS/SVN
• Support distributed workflow
• Guard against data corruption
• Be ridiculously fast
principles behind git

• distributed and parallel development
• one project, one repository
• never lose data without intervention
• unix philosophy built in
repos

• In a .git directory:
 • A set of commit objects
 • A set of references to commits (heads)
 • More stuff, but don’t worry about it.
commits
• A snapshot of the project at a given time
 • trees: subdirectories
 • blobs: files
• Link to parent commit(s)
• 40 character SHA1 hash
the object model
the big difference
tags (not web 2.0)
• Mark releases, important stuff
• Contains:
 • Committer
 • Message
 • Commit SHA
 • Signature (optional)
local commands
• Creating repositories
• Viewing history
• Performing a diff
• Merging branches
• Switching branches
actually using git
• porcelain vs. plumbing
• don’t be scared of your terminal
• GUI support is not 100% there yet
• yes, it works on Windows.
• plenty of import/interop tools
workflows


• simple & centralized
• hardcore forking action
simple & centralized


• basic workflow for most projects
• host your code at github, gitosis, etc
the staging area
create your project
$ rails toast2.0
[... blah blah blah ...]



$ cd toast2.0
$ git init
Initialized empty Git repository in /Users/qrush/Dev/toast2.0/.git/
more setup
$ edit .gitignore
$ git add .
$ git commit -m “first commit”
 [master (root-commit)]: created 8c24524: quot;Initial commitquot;
 41 files changed, 8452 insertions(+), 0 deletions(-)
 [.. files files files ..]
DONE.
Ok, maybe not.

$ edit config/environment.rb

$ script/generate migration
AddPosts
$ git status

# On branch master
# Changed but not updated:
#   (use quot;git add <file>...quot; to update what will be committe
#   (use quot;git checkout -- <file>...quot; to discard changes in w
directory)
#
#	 modified:   config/environment.rb
#
# Untracked files:
#   (use quot;git add <file>...quot; to include in what will be comm
#
#	 db/
no changes added to commit (use quot;git addquot; and/or quot;git commit
$ git diff

diff --git a/config/environment.rb b/config/environment.rb
index 631a3a3..dfc184b 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -15,10 +15,7 @@ Rails::Initializer.run do |config|
   # config.load_paths += %W( #{RAILS_ROOT}/extras )

    # Specify gems that this application depends on
-   # config.gem quot;bjquot;
-   # config.gem quot;hpricotquot;, :version => '0.6', :source => quot;ht
-   # config.gem quot;sqlite3-rubyquot;, :lib => quot;sqlite3quot;
-   # config.gem quot;aws-s3quot;, :lib => quot;aws/s3quot;
+   config.gem quot;thoughtbot-factory_girlquot;, :lib => quot;factory_gi
$ git add db/

$ git status

# On branch master
# Changes to be committed:
#   (use quot;git reset HEAD <file>...quot; to unstage)
#
#	 new file:   db/migrate/20090410120301_add_posts.rb
#
# Changed but not updated:
#   (use quot;git add <file>...quot; to update what will be committe
#   (use quot;git checkout -- <file>...quot; to discard changes in w
#
#	 config/environment.rb

$ git commit -m “Adding posts migration”
build your history
the grind

Hack away, fix bugs       vim / mate / etc

  Stage changes                git add

 Review changes          git status/diff

  Store changes               git commit
oh crap.
      git stash         temporarily store changes

  git checkout file      restore to last commit

   git reset file              unstage file

git reset --hard file     unstage & restore file

   git checkout -f         restore everything

  git revert commit         undo a changeset
hardcore forking action


• Fork means another repo
• Multiple repos means multiple branches
branches

      •   Cheap and local

      •   Easy to switch

      •   Try out new ideas

      •   Merging is way smarter
using a branch
                           create new branch
git checkout -b feature2


                            save some work
       git commit


                              switch back
  git checkout master


                           work is merged in
   git merge feature2


                           work played on top
  git rebase feature2


                             delete branch
 git branch -d feature2
merging (before)
merging (after)
rebasing (before)
rebasing (after)
merge vs. rebase
warning!

• Rebasing is rewriting history
• BAD for pushed commits
• Keep the repo in fast-forward
• (This doesn’t mean rebase is bad!)
syncing up
push away
$ git remote add origin git@github.com:qrush/
toast2.0.git

$ git push origin master

Counting objects: 78, done.
Compressing objects: 100% (71/71), done.
Writing objects: 100% (78/78), 80.49 KiB, done.
Total 78 (delta 21), reused 0 (delta 0)
To git@github.com:qrush/toast2.0.git
 * [new branch]      master -> master
sharing
  github                  awesome.
  gitosis          self-managed, ssh auth
git instaweb         instant web view
git daemon               local sharing
  gitjour            osx over bonjour
bringing down code

git fetch remote: get updates

git pull remote branch:

• get updates from remote for branch
• merge/rebase it into your current branch
basic pulling

$ git remote add mojombo git://
github.com/mojombo/jekyll.git
$ git pull mojombo master
go fetch
$ git remote add mojombo git://
github.com/mojombo/jekyll.git
$ git fetch mojombo
$ gitx
$ git merge mojombo/master
looking at upstream
after merge
topic branch
with a merge
Interactive Awesome.
git rebase -i

• Reordering commits
• Splitting up changesets
• Editing commits
• Dropping them completely
• Squashing multiple commits into one
$ git rebase -i HEAD~6

pick   a4d0f79   Adding posts in
pick   7e71afd   Revert quot;Adding posts inquot;
pick   5e815ec   Adding the right model
pick   956f4ce   Cleaning up model
pick   6c6cdb4   Who needs tests?
pick   c3481fd   Wrapping this up. Ship it.

# Rebase bd0ceed..c3481fd onto bd0ceed
#
# Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
$ git rebase -i HEAD~6

pick a4d0f79 Adding posts in
squash 7e71afd Revert quot;Adding posts inquot;
squash 5e815ec Adding the right model
squash 956f4ce Cleaning up model
squash 6c6cdb4 Who needs tests?
squash c3481fd Wrapping this up. Ship it.

# Rebase bd0ceed..c3481fd onto bd0ceed
#
# Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
squashed
learn more
• http://book.git-scm.com
• http://gitready.com
• http://learn.github.com
• http://gitcasts.com
• git internals peepcode
thanks
•   kudos to:

    •   Scott Chacon for awesome presentations

    •   Charles Duan for his great git tutorial

    •   Ben Hughes for bugging me to try git

    •   You for listening/reading

More Related Content

What's hot

Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Rueful Robin
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
Emanuele Olivetti
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Suman Mukherjee
 
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
Md Swawibe Ul Alam
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Somkiat Puisungnoen
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
Safique Ahmed Faruque
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Rupesh Kumar
 
Git 101
Git 101Git 101
Git 101
Sachet Mittal
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
Sébastien Saunier
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
Arnaud Seilles
 
Version control system
Version control systemVersion control system
Version control system
Andrew Liu
 

What's hot (20)

Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Git basics
Git basicsGit basics
Git basics
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Git 101
Git 101Git 101
Git 101
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Version control system
Version control systemVersion control system
Version control system
 

Viewers also liked

Manual jira , Instalación, Creación de Proyecto, Incidencias, Usuarios
Manual jira , Instalación, Creación de Proyecto, Incidencias, UsuariosManual jira , Instalación, Creación de Proyecto, Incidencias, Usuarios
Manual jira , Instalación, Creación de Proyecto, Incidencias, Usuarios
Leo Ruelas Rojas
 
Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git Hub
Nick Quaranto
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
BigBlueHat
 
Git studynotes
Git studynotesGit studynotes
Git studynotes
Richard Kuo
 
Métodos Ágiles y Scrum - A3
Métodos Ágiles y Scrum - A3Métodos Ágiles y Scrum - A3
Métodos Ágiles y Scrum - A3
Métodos Ágiles
 
Kanban 101 - 0 - Introduction
Kanban 101 - 0 - IntroductionKanban 101 - 0 - Introduction
Kanban 101 - 0 - Introduction
Michael Sahota
 
Presentacion kanban
Presentacion kanbanPresentacion kanban
Presentacion kanban
YN HS
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Randal Schwartz
 
Kanban Board Examples
Kanban Board ExamplesKanban Board Examples
Kanban Board Examples
Shore Labs
 
Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?
Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?
Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?
Miquel Mora
 
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
HubSpot
 
Getting Git
Getting GitGetting Git
Getting Git
Scott Chacon
 
Cuales son los problemas administrativos mas comunes que se presenta en cualq...
Cuales son los problemas administrativos mas comunes que se presenta en cualq...Cuales son los problemas administrativos mas comunes que se presenta en cualq...
Cuales son los problemas administrativos mas comunes que se presenta en cualq...
darioreynel
 

Viewers also liked (13)

Manual jira , Instalación, Creación de Proyecto, Incidencias, Usuarios
Manual jira , Instalación, Creación de Proyecto, Incidencias, UsuariosManual jira , Instalación, Creación de Proyecto, Incidencias, Usuarios
Manual jira , Instalación, Creación de Proyecto, Incidencias, Usuarios
 
Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git Hub
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
 
Git studynotes
Git studynotesGit studynotes
Git studynotes
 
Métodos Ágiles y Scrum - A3
Métodos Ágiles y Scrum - A3Métodos Ágiles y Scrum - A3
Métodos Ágiles y Scrum - A3
 
Kanban 101 - 0 - Introduction
Kanban 101 - 0 - IntroductionKanban 101 - 0 - Introduction
Kanban 101 - 0 - Introduction
 
Presentacion kanban
Presentacion kanbanPresentacion kanban
Presentacion kanban
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Kanban Board Examples
Kanban Board ExamplesKanban Board Examples
Kanban Board Examples
 
Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?
Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?
Historias de usuario¿Por qué? ¿Qué son? ¿Cómo son?
 
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
 
Getting Git
Getting GitGetting Git
Getting Git
 
Cuales son los problemas administrativos mas comunes que se presenta en cualq...
Cuales son los problemas administrativos mas comunes que se presenta en cualq...Cuales son los problemas administrativos mas comunes que se presenta en cualq...
Cuales son los problemas administrativos mas comunes que se presenta en cualq...
 

Similar to Git Started With Git

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Loading...git
Loading...gitLoading...git
Loading...git
Rafael García
 
Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)
Boise Web Technologies Group
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
Alberto Leal
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
tmacwilliam
 
Working with Git
Working with GitWorking with Git
Working with Git
Pete Nicholls
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
BADR
 
Git workshop
Git workshopGit workshop
Git workshop
Ray Toal
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
Javier Lafora Rey
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
Chris Johnson
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
David Newbury
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
Git basics
Git basicsGit basics
Git basics
Amit Sawhney
 
Working with Git
Working with GitWorking with Git
Working with Git
Sanghoon Hong
 
Gittalk
GittalkGittalk
Gittalk
prtinsley
 
Git presentation
Git presentationGit presentation
Git presentation
James Cuzella
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
seungzzang Kim
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Jedi Mind Tricks in Git
Jedi Mind Tricks in GitJedi Mind Tricks in Git
Jedi Mind Tricks in Git
Johan Abildskov
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
Jan Krag
 

Similar to Git Started With Git (20)

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
Git workshop
Git workshopGit workshop
Git workshop
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Git basics
Git basicsGit basics
Git basics
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Gittalk
GittalkGittalk
Gittalk
 
Git presentation
Git presentationGit presentation
Git presentation
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Git github
Git githubGit github
Git github
 
Jedi Mind Tricks in Git
Jedi Mind Tricks in GitJedi Mind Tricks in Git
Jedi Mind Tricks in Git
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 

Recently uploaded

What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 

Recently uploaded (20)

What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 

Git Started With Git

  • 1. git started with git Nick Quaranto nick@quaran.to NH.rb April 2009
  • 2. whoami • 5th year Software Engineering Major at RIT • Intern at Thoughtbot • Blogger at • http://github.com/blog • http://gitready.com • http://litanyagainstfear.com
  • 3. git pull origin slides http://drop.io/gitstarted
  • 4. what’s in store • ok, no more puns • i’m a ruby developer, not a kernel hacker • history lesson • concepts and principles • basic workflow
  • 5. what is git? “Git is a free distributed revision control, or software source code management project with an emphasis on being fast.” http://en.wikipedia.org/wiki/Git_(software)
  • 6. actually, git is a stupid content tracker.
  • 7. git’s history • Originally created to handle Linux kernel development • Everything else sucked. • Now used by plenty of other projects and web frameworks that don’t scale
  • 8. design motives • Do exactly the opposite of CVS/SVN • Support distributed workflow • Guard against data corruption • Be ridiculously fast
  • 9. principles behind git • distributed and parallel development • one project, one repository • never lose data without intervention • unix philosophy built in
  • 10. repos • In a .git directory: • A set of commit objects • A set of references to commits (heads) • More stuff, but don’t worry about it.
  • 11. commits • A snapshot of the project at a given time • trees: subdirectories • blobs: files • Link to parent commit(s) • 40 character SHA1 hash
  • 14. tags (not web 2.0) • Mark releases, important stuff • Contains: • Committer • Message • Commit SHA • Signature (optional)
  • 15. local commands • Creating repositories • Viewing history • Performing a diff • Merging branches • Switching branches
  • 16. actually using git • porcelain vs. plumbing • don’t be scared of your terminal • GUI support is not 100% there yet • yes, it works on Windows. • plenty of import/interop tools
  • 17. workflows • simple & centralized • hardcore forking action
  • 18. simple & centralized • basic workflow for most projects • host your code at github, gitosis, etc
  • 20. create your project $ rails toast2.0 [... blah blah blah ...] $ cd toast2.0 $ git init Initialized empty Git repository in /Users/qrush/Dev/toast2.0/.git/
  • 21. more setup $ edit .gitignore $ git add . $ git commit -m “first commit” [master (root-commit)]: created 8c24524: quot;Initial commitquot; 41 files changed, 8452 insertions(+), 0 deletions(-) [.. files files files ..]
  • 22. DONE.
  • 23. Ok, maybe not. $ edit config/environment.rb $ script/generate migration AddPosts
  • 24. $ git status # On branch master # Changed but not updated: # (use quot;git add <file>...quot; to update what will be committe # (use quot;git checkout -- <file>...quot; to discard changes in w directory) # # modified: config/environment.rb # # Untracked files: # (use quot;git add <file>...quot; to include in what will be comm # # db/ no changes added to commit (use quot;git addquot; and/or quot;git commit
  • 25. $ git diff diff --git a/config/environment.rb b/config/environment.rb index 631a3a3..dfc184b 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -15,10 +15,7 @@ Rails::Initializer.run do |config| # config.load_paths += %W( #{RAILS_ROOT}/extras ) # Specify gems that this application depends on - # config.gem quot;bjquot; - # config.gem quot;hpricotquot;, :version => '0.6', :source => quot;ht - # config.gem quot;sqlite3-rubyquot;, :lib => quot;sqlite3quot; - # config.gem quot;aws-s3quot;, :lib => quot;aws/s3quot; + config.gem quot;thoughtbot-factory_girlquot;, :lib => quot;factory_gi
  • 26. $ git add db/ $ git status # On branch master # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # new file: db/migrate/20090410120301_add_posts.rb # # Changed but not updated: # (use quot;git add <file>...quot; to update what will be committe # (use quot;git checkout -- <file>...quot; to discard changes in w # # config/environment.rb $ git commit -m “Adding posts migration”
  • 28. the grind Hack away, fix bugs vim / mate / etc Stage changes git add Review changes git status/diff Store changes git commit
  • 29. oh crap. git stash temporarily store changes git checkout file restore to last commit git reset file unstage file git reset --hard file unstage & restore file git checkout -f restore everything git revert commit undo a changeset
  • 30. hardcore forking action • Fork means another repo • Multiple repos means multiple branches
  • 31. branches • Cheap and local • Easy to switch • Try out new ideas • Merging is way smarter
  • 32. using a branch create new branch git checkout -b feature2 save some work git commit switch back git checkout master work is merged in git merge feature2 work played on top git rebase feature2 delete branch git branch -d feature2
  • 38. warning! • Rebasing is rewriting history • BAD for pushed commits • Keep the repo in fast-forward • (This doesn’t mean rebase is bad!)
  • 40. push away $ git remote add origin git@github.com:qrush/ toast2.0.git $ git push origin master Counting objects: 78, done. Compressing objects: 100% (71/71), done. Writing objects: 100% (78/78), 80.49 KiB, done. Total 78 (delta 21), reused 0 (delta 0) To git@github.com:qrush/toast2.0.git * [new branch] master -> master
  • 41. sharing github awesome. gitosis self-managed, ssh auth git instaweb instant web view git daemon local sharing gitjour osx over bonjour
  • 42. bringing down code git fetch remote: get updates git pull remote branch: • get updates from remote for branch • merge/rebase it into your current branch
  • 43. basic pulling $ git remote add mojombo git:// github.com/mojombo/jekyll.git $ git pull mojombo master
  • 44. go fetch $ git remote add mojombo git:// github.com/mojombo/jekyll.git $ git fetch mojombo $ gitx $ git merge mojombo/master
  • 49. Interactive Awesome. git rebase -i • Reordering commits • Splitting up changesets • Editing commits • Dropping them completely • Squashing multiple commits into one
  • 50. $ git rebase -i HEAD~6 pick a4d0f79 Adding posts in pick 7e71afd Revert quot;Adding posts inquot; pick 5e815ec Adding the right model pick 956f4ce Cleaning up model pick 6c6cdb4 Who needs tests? pick c3481fd Wrapping this up. Ship it. # Rebase bd0ceed..c3481fd onto bd0ceed # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit
  • 51. $ git rebase -i HEAD~6 pick a4d0f79 Adding posts in squash 7e71afd Revert quot;Adding posts inquot; squash 5e815ec Adding the right model squash 956f4ce Cleaning up model squash 6c6cdb4 Who needs tests? squash c3481fd Wrapping this up. Ship it. # Rebase bd0ceed..c3481fd onto bd0ceed # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit
  • 53. learn more • http://book.git-scm.com • http://gitready.com • http://learn.github.com • http://gitcasts.com • git internals peepcode
  • 54. thanks • kudos to: • Scott Chacon for awesome presentations • Charles Duan for his great git tutorial • Ben Hughes for bugging me to try git • You for listening/reading