SlideShare a Scribd company logo
INTRODUCTIONTO GIT
Drupal Camp LA 2015
Matthew Wrather
Wrather Creative
RACONTEUR
BONVIVANT
MAN OF MYSTERY
matt@wrathercreative.com
@mwrather
SOURCES
• A great talk by @merlyn himself, Randal Schwartz CC-BY-SA
• OnVimeo at https://vimeo.com/35778382
• Slides at http://slidesha.re/z7nQrG
• Pro Git by Scott Chacon CC-BY-NC-SA
• Read for free at http://git-scm.com/book
• And many more at http://lmgtfy.com/?q=git+tutorial
AGENDA
1.Why UseVersion Control
2. Git basic concepts
3. Demo
Time for questions after each section.
DOESN’T USEVERSION CONTROL
slworking on Flickr
CC-BY-NC-SA
WHAT IS GIT FOR?
Git is for…
• Tracks a tree of related files
• Distributed
• High Performance
• Easy & Fast Branch/Merge
• Good Data Integrity
• Collaborative

Git is not for…
• Tracking unrelated files
• Tracking File Metadata
• Binary Files
DEMO
WRAPYOUR MIND AROUND
• Distributed:Your repository is complete unto itself.
• Anyone can commit!*
*To their own repo.
• (Once you start fetching and pushing work,

permissions come into play.)
• There can still be a central, blessed repo.
• Universal Public Identifiers: SHA1 hashes
OBJECTS IN GIT
• Blobs (actual data)
• Trees (directories of blobs or of other trees)
• A commit, which is:
• A tree
• Zero or more parent commits
• Metadata (commit message, name email, timestamp)
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
QUESTIONS?
WE NEEDTOTALK
ABOUT COMMITMENT
Do this
Work
Stage
Commit

here
Filesystem
Staging Area
Repository

(aka here)
WorkingTree
Index
HEAD

by
writing code
git add
git commit
Rinse and Repeat
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git commit
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git branch testing
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git checkout testing
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ subl awesome.module
$ git add awesome.module
$ git commit -m ‘changed awesome module’
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git checkout master
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
$ git checkout -b iss53 # shortcut for:
$ # git branch iss53
$ # git checkout iss53
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
FAST FORWARD MERGE
$ git checkout master
$ git merge hotfix
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
FAST FORWARD MERGE
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
FAST FORWARD MERGE
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
FAST FORWARD MERGE
$ git branch -d hotfix
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
RECURSIVE MERGE
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
RECURSIVE MERGE
$ git checkout master
$ git merge iss53
DEMO
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
$ git checkout experiment
$ git rebase master
Thou shalt not rebase commits that you
have pushed to a remote repository.
REMOTE REPOSITORIES
• All these things that we’ve done so far happen in the privacy
of our own computer and don’t affect anything else.
• As a beginner, you are going to be using other people’s
repositories more than you are going to create your own
git clone <remoteUrl>
• <remoteURL> can be HTTP, SSH, or git:// depending on your
permissions
REMOTE REPOSITORIES
• When you copy a repo using the git clone command,

you’ll automatically have a remote called origin
• It’s possible to have many, many remotes. It can be hard to
keep track of.You probably don’t need to worry about it.
REMOTE REPOSITORIES
• When you’ve done working, you can “push” your work up to a
remote repository
git push <remote-nickname> <branch>
git push origin master
• But if someone else has done work and pushed it to the
remote repo, git won’t let you overwrite.
REMOTE REPOSITORIES
• To find out what’s on the server, you can “fetch” from a
remote repository
git fetch <remote-nickname>
git fetch origin
• Remote branches will be tracked locally, prefixed with the
remote nickname.The master branch on origin becomes
origin/master locally.
REMOTE REPOSITORIES
$ git push origin master
[git error message]
$ git fetch origin
$ git merge origin/master
$ git push master
[HUGE SUCCESS!]
DEMO
QUESTIONS?
THANKYOU!
Matthew Wrather • @mwrather
matt@wrathercreative.com • (510) WRA-THER

More Related Content

What's hot

Git tutorial
Git tutorialGit tutorial
Git tutorial
Elli Kanal
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
Sébastien Saunier
 
Inside GitHub
Inside GitHubInside GitHub
Inside GitHub
err
 
Git 101 tutorial presentation
Git 101 tutorial presentationGit 101 tutorial presentation
Git 101 tutorial presentationTerry Wang
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
SV Ruby on Rails Meetup
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
Thomas Rausch
 
Github basics
Github basicsGithub basics
Github basics
Radoslav Georgiev
 
Git & Github for beginners
Git & Github for beginnersGit & Github for beginners
Git & Github for beginners
Paulo Henrique Nonaka
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamental
Rajesh Kumar
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
Naim Latifi
 
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
Shawn Doyle
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 

What's hot (20)

Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
Inside GitHub
Inside GitHubInside GitHub
Inside GitHub
 
Git 101 tutorial presentation
Git 101 tutorial presentationGit 101 tutorial presentation
Git 101 tutorial presentation
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Github basics
Github basicsGithub basics
Github basics
 
Git & Github for beginners
Git & Github for beginnersGit & Github for beginners
Git & Github for beginners
 
git and github
git and githubgit and github
git and github
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamental
 
Git and Github
Git and GithubGit and Github
Git and Github
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Git basics
Git basicsGit basics
Git basics
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Git 101
Git 101Git 101
Git 101
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
 
Introduction git
Introduction gitIntroduction git
Introduction git
 

Similar to Introduction to Git, DrupalCamp LA 2015

Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Rick Umali
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
EffectiveUI
 
SCM for Android Developers Using Git
SCM for Android Developers Using GitSCM for Android Developers Using Git
SCM for Android Developers Using Git
Tony Hillerson
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
Effective
 
Github
GithubGithub
Working with Git
Working with GitWorking with Git
Working with Git
Tony Hillerson
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
BigBlueHat
 
Git'in on Windows
Git'in on WindowsGit'in on Windows
Git'in on Windows
Stacy Vicknair
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
Tony Hillerson
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
mpvanwinkle
 
Git简介
Git简介Git简介
Git简介
clvrobj
 
Git tips and tricks
Git   tips and tricksGit   tips and tricks
Git tips and tricks
Chris Ballance
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
David Newbury
 
Code review vs pull request
Code review vs pull requestCode review vs pull request
Code review vs pull request
Bryan Liu
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
Kishor Kumar
 
Git
GitGit
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
Anwarul Islam
 
Git Introductive
Git IntroductiveGit Introductive
Git IntroductiveAdham Saad
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
tmacwilliam
 

Similar to Introduction to Git, DrupalCamp LA 2015 (20)

Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
 
SCM for Android Developers Using Git
SCM for Android Developers Using GitSCM for Android Developers Using Git
SCM for Android Developers Using Git
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
 
Github
GithubGithub
Github
 
Working with Git
Working with GitWorking with Git
Working with Git
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Git'in on Windows
Git'in on WindowsGit'in on Windows
Git'in on Windows
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
 
Git简介
Git简介Git简介
Git简介
 
Git tips and tricks
Git   tips and tricksGit   tips and tricks
Git tips and tricks
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Code review vs pull request
Code review vs pull requestCode review vs pull request
Code review vs pull request
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Git
GitGit
Git
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Git Introductive
Git IntroductiveGit Introductive
Git Introductive
 
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
 

Recently uploaded

IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 

Introduction to Git, DrupalCamp LA 2015

  • 1. INTRODUCTIONTO GIT Drupal Camp LA 2015 Matthew Wrather Wrather Creative
  • 3. SOURCES • A great talk by @merlyn himself, Randal Schwartz CC-BY-SA • OnVimeo at https://vimeo.com/35778382 • Slides at http://slidesha.re/z7nQrG • Pro Git by Scott Chacon CC-BY-NC-SA • Read for free at http://git-scm.com/book • And many more at http://lmgtfy.com/?q=git+tutorial
  • 4. AGENDA 1.Why UseVersion Control 2. Git basic concepts 3. Demo Time for questions after each section.
  • 6. WHAT IS GIT FOR? Git is for… • Tracks a tree of related files • Distributed • High Performance • Easy & Fast Branch/Merge • Good Data Integrity • Collaborative
 Git is not for… • Tracking unrelated files • Tracking File Metadata • Binary Files
  • 7.
  • 9. WRAPYOUR MIND AROUND • Distributed:Your repository is complete unto itself. • Anyone can commit!* *To their own repo. • (Once you start fetching and pushing work,
 permissions come into play.) • There can still be a central, blessed repo. • Universal Public Identifiers: SHA1 hashes
  • 10. OBJECTS IN GIT • Blobs (actual data) • Trees (directories of blobs or of other trees) • A commit, which is: • A tree • Zero or more parent commits • Metadata (commit message, name email, timestamp)
  • 11. graphic from Pro Git by Scott Chacon CC-BY-NC-SA
  • 13. WE NEEDTOTALK ABOUT COMMITMENT Do this Work Stage Commit
 here Filesystem Staging Area Repository
 (aka here) WorkingTree Index HEAD
 by writing code git add git commit Rinse and Repeat
  • 14. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES
  • 15. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git commit
  • 16. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git branch testing
  • 17. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES
  • 18. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git checkout testing
  • 19. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ subl awesome.module $ git add awesome.module $ git commit -m ‘changed awesome module’
  • 20. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git checkout master
  • 21. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES
  • 22. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING
  • 23. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING $ git checkout -b iss53 # shortcut for: $ # git branch iss53 $ # git checkout iss53
  • 24. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING
  • 25. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING
  • 26. FAST FORWARD MERGE $ git checkout master $ git merge hotfix
  • 27. graphic from Pro Git by Scott Chacon CC-BY-NC-SA FAST FORWARD MERGE
  • 28. graphic from Pro Git by Scott Chacon CC-BY-NC-SA FAST FORWARD MERGE
  • 29. graphic from Pro Git by Scott Chacon CC-BY-NC-SA FAST FORWARD MERGE $ git branch -d hotfix
  • 30. graphic from Pro Git by Scott Chacon CC-BY-NC-SA RECURSIVE MERGE
  • 31. graphic from Pro Git by Scott Chacon CC-BY-NC-SA RECURSIVE MERGE $ git checkout master $ git merge iss53
  • 32. DEMO
  • 33. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING
  • 34. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING
  • 35. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING
  • 36. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING $ git checkout experiment $ git rebase master
  • 37. Thou shalt not rebase commits that you have pushed to a remote repository.
  • 38. REMOTE REPOSITORIES • All these things that we’ve done so far happen in the privacy of our own computer and don’t affect anything else. • As a beginner, you are going to be using other people’s repositories more than you are going to create your own git clone <remoteUrl> • <remoteURL> can be HTTP, SSH, or git:// depending on your permissions
  • 39. REMOTE REPOSITORIES • When you copy a repo using the git clone command,
 you’ll automatically have a remote called origin • It’s possible to have many, many remotes. It can be hard to keep track of.You probably don’t need to worry about it.
  • 40. REMOTE REPOSITORIES • When you’ve done working, you can “push” your work up to a remote repository git push <remote-nickname> <branch> git push origin master • But if someone else has done work and pushed it to the remote repo, git won’t let you overwrite.
  • 41. REMOTE REPOSITORIES • To find out what’s on the server, you can “fetch” from a remote repository git fetch <remote-nickname> git fetch origin • Remote branches will be tracked locally, prefixed with the remote nickname.The master branch on origin becomes origin/master locally.
  • 42. REMOTE REPOSITORIES $ git push origin master [git error message] $ git fetch origin $ git merge origin/master $ git push master [HUGE SUCCESS!]
  • 43. DEMO
  • 45. THANKYOU! Matthew Wrather • @mwrather matt@wrathercreative.com • (510) WRA-THER