SlideShare a Scribd company logo
1 of 77
WORKING WITH GIT
                Distributed version control and you




Pete Nicholls                                       @Aupajo
                                            github.com/Aupajo
Git
WHY SWITCH?


More flexible

Better tools

Better workflow

More people are using it
Git is distributed version control.
SUBVERSION
SUBVERSION



             revision 2




revision 2                revision 2
SUBVERSION


Commit!
                   revision 2




      revision 2                revision 2
SUBVERSION



             revision 3




revision 3                revision 2
SUBVERSION



             revision 3




revision 3                revision 3
GIT



908bc475         be8decb9
GIT
Commit!




      908bc475         be8decb9
GIT



72f9b575         be8decb9
GIT
                            Pull!




72f9b575         be8decb9
GIT



72f9b575         72f9b575
GIT




There is no “one copy”...
GIT




...but usually you’ll agree on a central repository.
Git is local.
EVERYTHING IS LOCAL

Everything is stored in a “.git” directory at the root of your
project

Commits are local

Branches are local

You don’t check out the latest revision – you clone the
whole repository
Pros                          Cons

Work offline

Carry your repository on a
flash drive

Work on experimental
branches without cluttering
                                 A big repository means a large
up other people’s repositories
                                        initial download
Share when you’re ready

No more waiting in line

Easy to set up, no server to
run
Git is a collection of tools.
Git has “cheap” branching.
Workflow
Bob
Hello.




Bob
Bob
Bob
CHURCH
       of BOB




Bob
Down,
      heathens.


                  CHURCH
                   of BOB




Bob
$ mkdir holybook

$ cd holybook

$ git init
Working Copy       Staging Area             Commit
  (Your Project)   (Preparing the commit)
Working Copy       Staging Area             Commit
  (Your Project)   (Preparing the commit)
Working Copy                 Staging Area             Commit
  (Your Project)             (Preparing the commit)




                   git add
Working Copy                 Staging Area             Commit
  (Your Project)             (Preparing the commit)




                   git add
Working Copy       Staging Area             Commit
  (Your Project)   (Preparing the commit)
Working Copy       Staging Area                    Commit
  (Your Project)   (Preparing the commit)




                                            git commit
Working Copy       Staging Area                    Commit
  (Your Project)   (Preparing the commit)




                                            git commit
Working Copy       Staging Area                    Commit
  (Your Project)   (Preparing the commit)




                                            git commit
Working Copy       Staging Area             Commit
  (Your Project)   (Preparing the commit)
Chapter I
Genesis

In the beginning was the word, and
the word was Bob, who accepted all
forms of credit card, yea, even
Discover.

# Saved ‘chapter1.txt’
$ git status

# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to
include in what will be committed)
#
#	 chapter1.txt
$ git add chapter1.txt

$ git status

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..."
to unstage)
#
#	 new file:   chapter1.txt
#
$ git commit -m “Added the first
chapter.”

[master (root-commit) 8621aee] Added
the first chapter.
 1 files changed, 1 insertions(+), 0
deletions(-)
 create mode 100644 chapter1.txt
$ git log
commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84
Author: Pete Nicholls <pete@metanation.com>
Date:   Sat Apr 9 16:31:28 2011 +1200

    Added delimiter to points.

diff --git a/app/helpers/application_helper.rb b/app/helpers/
application_helper.rb
index 37d4a59..c442368 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
   end

    def plain_points(points)
-     "#{points} points"
+     "#{number_with_delimiter points} points"
    end

    def link_to_with_count(text, link = nil, count = 0, options = {})
$ git log
commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84
Author: Pete Nicholls <pete@metanation.com>
Date:   Sat Apr 9 16:31:28 2011 +1200

    Added delimiter to points.

diff --git a/app/helpers/application_helper.rb b/app/helpers/
application_helper.rb
index 37d4a59..c442368 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
   end

    def plain_points(points)
-     "#{points} points"
+     "#{number_with_delimiter points} points"
    end

    def link_to_with_count(text, link = nil, count = 0, options = {})
$ git log
commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84
Author: Pete Nicholls <pete@metanation.com>
Date:   Sat Apr 9 16:31:28 2011 +1200

    Added delimiter to points.

diff --git a/app/helpers/application_helper.rb b/app/helpers/
application_helper.rb
index 37d4a59..c442368 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
   end

    def plain_points(points)
-     "#{points} points"
+     "#{number_with_delimiter points} points"
    end

    def link_to_with_count(text, link = nil, count = 0, options = {})
$ git log
commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84
Author: Pete Nicholls <pete@metanation.com>
Date:   Sat Apr 9 16:31:28 2011 +1200

    Added delimiter to points.

diff --git a/app/helpers/application_helper.rb b/app/helpers/
application_helper.rb
index 37d4a59..c442368 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
   end

    def plain_points(points)
-     "#{points} points"
+     "#{number_with_delimiter points} points"
    end

    def link_to_with_count(text, link = nil, count = 0, options = {})
$ git log
commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84
Author: Pete Nicholls <pete@metanation.com>
Date:   Sat Apr 9 16:31:28 2011 +1200

    Added delimiter to points.

diff --git a/app/helpers/application_helper.rb b/app/helpers/
application_helper.rb
index 37d4a59..c442368 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
   end

    def plain_points(points)
-     "#{points} points"
+     "#{number_with_delimiter points} points"
    end

    def link_to_with_count(text, link = nil, count = 0, options = {})
$ git log
commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84
Author: Pete Nicholls <pete@metanation.com>
Date:   Sat Apr 9 16:31:28 2011 +1200

    Added delimiter to points.

diff --git a/app/helpers/application_helper.rb b/app/helpers/
application_helper.rb
index 37d4a59..c442368 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
   end

    def plain_points(points)
-     "#{points} points"
+     "#{number_with_delimiter points} points"
    end

    def link_to_with_count(text, link = nil, count = 0, options = {})
Author

     Date

Commit Message

     Diff
Author

     Date
                 f9ac73d56d3852d1878...
Commit Message

     Diff
Bob
Bob   Tim
Bob   Tim
Bob
Tome of Secrets
Bob
$ git remote add origin
  git://tomeofsecrets/holybook.git

$ git push origin master
$ git clone
   git://tomeofsecrets/holybook.git

$ cd holybook
Chapter II
Tim the Enchanter

Bob said unto Tim, “Yea, and we will
make so much money.” And Tim saw that
it was good, or at least better than
his usual Saturday nights out.

# Saved ‘chapter2.txt’
$ git add chapter2.txt

$ git commit -m “Added the second
chapter.”

$ git push origin master




             $ git pull origin master

             $ ls
               chapter1.txt    chapter2.txt
$ git commit -m “Added the bit with
the killer rabbit.”

$ git commit -m “Added the bit with
the bridge crossing.”

$ git commit -m “Proper coconut use.”




             $ git commit -m “Added smiting.”

             $ git commit -m “Turned peasant into
             a mustard pot.”

             $ git commit -m “Extra smiting.”
$ git checkout -b commandments

$ git branch
  master
* commandments
$ git checkout -b commandments

$ git add commandments.txt

$ git commit -m “Started
commandments.”

$ ls
  chapter1.txt     chapter2.txt
  commandments.txt

$ git checkout master

$ ls
  chapter1.txt    chapter2.txt
$ git checkout commandments

$ git commit -m “Thou shalt not stand
in the doorway to chat, thus blocking
other shoppers access to the grocery
aisle.”

$ git commit -m “Thou shalt think
goat horns are cool.”

$ git checkout master

$ git merge commandments
Branches

master                  master
smiting              commandments




            master
Branches

master                  master
smiting              commandments




            master
“Thou shalt not be judged for not showering.”
$ git remote add churchoftim
  git://churchoftim/holybook.git

$ git push churchoftim master
Forks



tomeofsecrets           churchoftim
Forks



tomeofsecrets           churchoftim
Using Git
msygit
Git for the command-line.
http://git-scm.com

TortoiseGit
File browser and contextual
menu integration, port of
TortoiseSVN.
http://code.google.com/p/tortoisegit

Cygwin
Linux environment for
Windows. Git available
through package manager.
http://cygwin.com
Homebrew
brew install git
https://github.com/mxcl/homebrew

MacPorts
port install git
http://code.google.com/p/tortoisegit

Tower
Very polished Git GUI.
http://git-tower.com
Tower
http://git-tower.com
EGit
http://eclipse.org/egit/
GitHub
http://github.com
Demo
http://github.com

More Related Content

What's hot

Git Basics - RubyFest 2009
Git Basics - RubyFest 2009Git Basics - RubyFest 2009
Git Basics - RubyFest 2009Ariejan de Vroom
 
Version Control and Git - GitHub Workshop
Version Control and Git - GitHub WorkshopVersion Control and Git - GitHub Workshop
Version Control and Git - GitHub WorkshopAll Things Open
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICLa FeWeb
 
Git workshop
Git workshopGit workshop
Git workshopRay Toal
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginnersbryanbibat
 
Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]Saajid Akram
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)bryanbibat
 
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
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advancedYodalee
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails UndergroundAriejan de Vroom
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 

What's hot (20)

Git Basics - RubyFest 2009
Git Basics - RubyFest 2009Git Basics - RubyFest 2009
Git Basics - RubyFest 2009
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git and Github
Git and GithubGit and Github
Git and Github
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git Basic
Git BasicGit Basic
Git Basic
 
Version Control and Git - GitHub Workshop
Version Control and Git - GitHub WorkshopVersion Control and Git - GitHub Workshop
Version Control and Git - GitHub Workshop
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETIC
 
Git workshop
Git workshopGit workshop
Git workshop
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginners
 
Basic Git
Basic GitBasic Git
Basic Git
 
Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
 
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
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advanced
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails Underground
 
Git
GitGit
Git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 

Similar to Working with Git

Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Git cheat-sheets
Git cheat-sheetsGit cheat-sheets
Git cheat-sheetsozone777
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierChristoph Matthies
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Codemotion
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitRick Umali
 
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 Bosstmacwilliam
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlBecky Todd
 

Similar to Working with Git (20)

Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Gittalk
GittalkGittalk
Gittalk
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Becoming a Git Master
Becoming a Git MasterBecoming a Git Master
Becoming a Git Master
 
Git cheat-sheets
Git cheat-sheetsGit cheat-sheets
Git cheat-sheets
 
Git basics
Git basicsGit basics
Git basics
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 
T3dd10 git
T3dd10 gitT3dd10 git
T3dd10 git
 
Git_real_slides
Git_real_slidesGit_real_slides
Git_real_slides
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to 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
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Git github
Git githubGit github
Git github
 
git session --interactive
git session --interactivegit session --interactive
git session --interactive
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
3 Git
3 Git3 Git
3 Git
 

More from Pete Nicholls

Naming Things (with notes)
Naming Things (with notes)Naming Things (with notes)
Naming Things (with notes)Pete Nicholls
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to ErlangPete Nicholls
 
Rapid Web Design Prototyping with HTML5 and WebKit
Rapid Web Design Prototyping with HTML5 and WebKitRapid Web Design Prototyping with HTML5 and WebKit
Rapid Web Design Prototyping with HTML5 and WebKitPete Nicholls
 

More from Pete Nicholls (6)

Naming Things (with notes)
Naming Things (with notes)Naming Things (with notes)
Naming Things (with notes)
 
Naming Things
Naming ThingsNaming Things
Naming Things
 
Ernest Code
Ernest CodeErnest Code
Ernest Code
 
Brewbot
BrewbotBrewbot
Brewbot
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 
Rapid Web Design Prototyping with HTML5 and WebKit
Rapid Web Design Prototyping with HTML5 and WebKitRapid Web Design Prototyping with HTML5 and WebKit
Rapid Web Design Prototyping with HTML5 and WebKit
 

Recently uploaded

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.pdfsudhanshuwaghmare1
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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 challengesrafiqahmad00786416
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
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...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
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...DianaGray10
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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 FMESafe Software
 
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, ...apidays
 
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?Igalia
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
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...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
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)wesley chun
 

Recently uploaded (20)

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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
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, ...
 
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?
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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)
 

Working with Git

  • 1. WORKING WITH GIT Distributed version control and you Pete Nicholls @Aupajo github.com/Aupajo
  • 2. Git
  • 3. WHY SWITCH? More flexible Better tools Better workflow More people are using it
  • 4. Git is distributed version control.
  • 6. SUBVERSION revision 2 revision 2 revision 2
  • 7. SUBVERSION Commit! revision 2 revision 2 revision 2
  • 8. SUBVERSION revision 3 revision 3 revision 2
  • 9. SUBVERSION revision 3 revision 3 revision 3
  • 10. GIT 908bc475 be8decb9
  • 11. GIT Commit! 908bc475 be8decb9
  • 12. GIT 72f9b575 be8decb9
  • 13. GIT Pull! 72f9b575 be8decb9
  • 14. GIT 72f9b575 72f9b575
  • 15. GIT There is no “one copy”...
  • 16. GIT ...but usually you’ll agree on a central repository.
  • 18. EVERYTHING IS LOCAL Everything is stored in a “.git” directory at the root of your project Commits are local Branches are local You don’t check out the latest revision – you clone the whole repository
  • 19. Pros Cons Work offline Carry your repository on a flash drive Work on experimental branches without cluttering A big repository means a large up other people’s repositories initial download Share when you’re ready No more waiting in line Easy to set up, no server to run
  • 20. Git is a collection of tools.
  • 21. Git has “cheap” branching.
  • 23. Bob
  • 25. Bob
  • 26. Bob
  • 27. CHURCH of BOB Bob
  • 28. Down, heathens. CHURCH of BOB Bob
  • 29. $ mkdir holybook $ cd holybook $ git init
  • 30. Working Copy Staging Area Commit (Your Project) (Preparing the commit)
  • 31. Working Copy Staging Area Commit (Your Project) (Preparing the commit)
  • 32. Working Copy Staging Area Commit (Your Project) (Preparing the commit) git add
  • 33. Working Copy Staging Area Commit (Your Project) (Preparing the commit) git add
  • 34. Working Copy Staging Area Commit (Your Project) (Preparing the commit)
  • 35. Working Copy Staging Area Commit (Your Project) (Preparing the commit) git commit
  • 36. Working Copy Staging Area Commit (Your Project) (Preparing the commit) git commit
  • 37. Working Copy Staging Area Commit (Your Project) (Preparing the commit) git commit
  • 38. Working Copy Staging Area Commit (Your Project) (Preparing the commit)
  • 39. Chapter I Genesis In the beginning was the word, and the word was Bob, who accepted all forms of credit card, yea, even Discover. # Saved ‘chapter1.txt’
  • 40. $ git status # On branch master # # Initial commit # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # chapter1.txt
  • 41. $ git add chapter1.txt $ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: chapter1.txt #
  • 42. $ git commit -m “Added the first chapter.” [master (root-commit) 8621aee] Added the first chapter. 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 chapter1.txt
  • 43. $ git log commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84 Author: Pete Nicholls <pete@metanation.com> Date: Sat Apr 9 16:31:28 2011 +1200 Added delimiter to points. diff --git a/app/helpers/application_helper.rb b/app/helpers/ application_helper.rb index 37d4a59..c442368 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,7 +41,7 @@ module ApplicationHelper end def plain_points(points) - "#{points} points" + "#{number_with_delimiter points} points" end def link_to_with_count(text, link = nil, count = 0, options = {})
  • 44. $ git log commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84 Author: Pete Nicholls <pete@metanation.com> Date: Sat Apr 9 16:31:28 2011 +1200 Added delimiter to points. diff --git a/app/helpers/application_helper.rb b/app/helpers/ application_helper.rb index 37d4a59..c442368 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,7 +41,7 @@ module ApplicationHelper end def plain_points(points) - "#{points} points" + "#{number_with_delimiter points} points" end def link_to_with_count(text, link = nil, count = 0, options = {})
  • 45. $ git log commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84 Author: Pete Nicholls <pete@metanation.com> Date: Sat Apr 9 16:31:28 2011 +1200 Added delimiter to points. diff --git a/app/helpers/application_helper.rb b/app/helpers/ application_helper.rb index 37d4a59..c442368 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,7 +41,7 @@ module ApplicationHelper end def plain_points(points) - "#{points} points" + "#{number_with_delimiter points} points" end def link_to_with_count(text, link = nil, count = 0, options = {})
  • 46. $ git log commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84 Author: Pete Nicholls <pete@metanation.com> Date: Sat Apr 9 16:31:28 2011 +1200 Added delimiter to points. diff --git a/app/helpers/application_helper.rb b/app/helpers/ application_helper.rb index 37d4a59..c442368 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,7 +41,7 @@ module ApplicationHelper end def plain_points(points) - "#{points} points" + "#{number_with_delimiter points} points" end def link_to_with_count(text, link = nil, count = 0, options = {})
  • 47. $ git log commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84 Author: Pete Nicholls <pete@metanation.com> Date: Sat Apr 9 16:31:28 2011 +1200 Added delimiter to points. diff --git a/app/helpers/application_helper.rb b/app/helpers/ application_helper.rb index 37d4a59..c442368 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,7 +41,7 @@ module ApplicationHelper end def plain_points(points) - "#{points} points" + "#{number_with_delimiter points} points" end def link_to_with_count(text, link = nil, count = 0, options = {})
  • 48. $ git log commit f9ac73d56d3852d1878a4d8a2309ecfda4472e84 Author: Pete Nicholls <pete@metanation.com> Date: Sat Apr 9 16:31:28 2011 +1200 Added delimiter to points. diff --git a/app/helpers/application_helper.rb b/app/helpers/ application_helper.rb index 37d4a59..c442368 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,7 +41,7 @@ module ApplicationHelper end def plain_points(points) - "#{points} points" + "#{number_with_delimiter points} points" end def link_to_with_count(text, link = nil, count = 0, options = {})
  • 49. Author Date Commit Message Diff
  • 50. Author Date f9ac73d56d3852d1878... Commit Message Diff
  • 51. Bob
  • 52. Bob Tim
  • 53. Bob Tim
  • 54. Bob
  • 56. $ git remote add origin git://tomeofsecrets/holybook.git $ git push origin master
  • 57. $ git clone git://tomeofsecrets/holybook.git $ cd holybook
  • 58. Chapter II Tim the Enchanter Bob said unto Tim, “Yea, and we will make so much money.” And Tim saw that it was good, or at least better than his usual Saturday nights out. # Saved ‘chapter2.txt’
  • 59. $ git add chapter2.txt $ git commit -m “Added the second chapter.” $ git push origin master $ git pull origin master $ ls chapter1.txt chapter2.txt
  • 60. $ git commit -m “Added the bit with the killer rabbit.” $ git commit -m “Added the bit with the bridge crossing.” $ git commit -m “Proper coconut use.” $ git commit -m “Added smiting.” $ git commit -m “Turned peasant into a mustard pot.” $ git commit -m “Extra smiting.”
  • 61. $ git checkout -b commandments $ git branch master * commandments
  • 62. $ git checkout -b commandments $ git add commandments.txt $ git commit -m “Started commandments.” $ ls chapter1.txt chapter2.txt commandments.txt $ git checkout master $ ls chapter1.txt chapter2.txt
  • 63. $ git checkout commandments $ git commit -m “Thou shalt not stand in the doorway to chat, thus blocking other shoppers access to the grocery aisle.” $ git commit -m “Thou shalt think goat horns are cool.” $ git checkout master $ git merge commandments
  • 64. Branches master master smiting commandments master
  • 65. Branches master master smiting commandments master
  • 66. “Thou shalt not be judged for not showering.”
  • 67.
  • 68. $ git remote add churchoftim git://churchoftim/holybook.git $ git push churchoftim master
  • 69. Forks tomeofsecrets churchoftim
  • 70. Forks tomeofsecrets churchoftim
  • 72. msygit Git for the command-line. http://git-scm.com TortoiseGit File browser and contextual menu integration, port of TortoiseSVN. http://code.google.com/p/tortoisegit Cygwin Linux environment for Windows. Git available through package manager. http://cygwin.com
  • 73. Homebrew brew install git https://github.com/mxcl/homebrew MacPorts port install git http://code.google.com/p/tortoisegit Tower Very polished Git GUI. http://git-tower.com

Editor's Notes

  1. I&amp;#x2019;m not a Git expert, just a happy user for the last three years. Before that, I used Subversion.\n
  2. Created in 2005 by Linus Torvalds to work on the Linux kernel\nBuilt around the concepts of distributed version control and non-linear development\n
  3. \n
  4. What do we mean by &amp;#x201C;distributed&amp;#x201D;? Let&amp;#x2019;s take a look at an example using Subversion.\n
  5. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  6. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  7. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  8. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  9. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  10. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  11. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  12. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  13. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  14. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  15. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  16. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  17. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  18. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  19. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  20. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  21. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  22. Person A makes commits his changes to the Subversion server. Person B updates their working copy from the server.\n
  23. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  24. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  25. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  26. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  27. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  28. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  29. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  30. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  31. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  32. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  33. In the Git world, there is no central server. Repositories live locally on a person&amp;#x2019;s hard drive. There are no revision numbers &amp;#x2013; instead there&amp;#x2019;s a hash representing each commit. One person can pull from another person&amp;#x2019;s repository into their own. They don&amp;#x2019;t need to pull all changes.\n
  34. There is no one copy. Different people can merge and track other people&amp;#x2019;s branches. The result is it&amp;#x2019;s possible for different development workflows than &amp;#x201C;one linear log of work.&amp;#x201D; Having said that...\n
  35. ...in most projects, you will have a central, canonical repository, because it&amp;#x2019;s convenient. But you don&amp;#x2019;t have to share all your branches and commits with it. [Compare Subversion/trunk Git/master]\n
  36. Everything in git is local.\n
  37. \n
  38. \n
  39. Git is a collection of tools. Git works well by itself, but it plays better with friends. It&amp;#x2019;s designed to work as part of an ecosystem of development. It knows that version control is just a tool, that&amp;#x2019;s part of your workflow as a developer. It stresses flexibility, speed, and integration with your workflow. [Prune large files, branch/merge speeds, Git hooks as example]\n
  40. One of the things you&amp;#x2019;ll hear quite often. It refers to the method and speed that Git handles branches. When a branch takes a half second to create and incurs no file size penalty, it&amp;#x2019;s trivial to create them. When you don&amp;#x2019;t have to share them, you don&amp;#x2019;t need to worry about making too many branches. It&amp;#x2019;s also easy to branch from a branch, which is common.\n
  41. Simple example workflow. Nothing earth-shattering.\n
  42. Meet Bob.\n
  43. \n
  44. Bob has an ambition.\n
  45. He wants to start his own religion.\n
  46. The Church of Bob\n
  47. \n
  48. He starts by writing his holy book. [Explain git init]\nNext: Working copy/staging area\n
  49. [Explain concepts]\nLet&amp;#x2019;s say we change a file...\n
  50. \n
  51. We use git add to move it into the staging area. \n
  52. \n
  53. Once in the area [explain about how making changes won&amp;#x2019;t affect the staging area&amp;#x2019;s version]\n
  54. \n
  55. Git commit will save the changes in the staging area along with a commit message.\n
  56. \n
  57. Let&amp;#x2019;s go back to Bob, who&amp;#x2019;s written his first chapter of the Book of Bob.\n
  58. He&amp;#x2019;s saved the file as &amp;#x2018;chapter1.txt&amp;#x2019;\nNext: git status\n
  59. Next: git add\n
  60. Next: git commit\n
  61. Next: hashes\n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. Next: Bob makes a friend\n
  69. Bob makes a friend...\n
  70. Meet Tim.\nNext: create tome of secrets\n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. Next: branches\n
  83. Next: Bob and Tim part ways\n
  84. \n
  85. As in common in open source...\n
  86. \n
  87. Next: Using Git\n
  88. Next: Using Git\n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n