SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

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

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

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

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

Último

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Último (20)

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

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

Notas do Editor

  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