SlideShare une entreprise Scribd logo
1  sur  40
Télécharger pour lire hors ligne
Open Source Collaboration
   with Git and GitHub
      by Benjamin Young
     adapted from work by
        Nick Quaranto
whoami
• President of BigBlueHat
  – a web manufacturing company
  – we build web stuff
• We built BlueInk
   – a content management system
• Building sites since the late 90's
   – I remember Netscape 3
Ve rs io n Co ntro l
c o uld s a v e y o ur
        life .
Or a t le a s t y o ur
jo b/pro je c t/ide a /
    s a nity /g pa
The Basics
• Keep “backup” copies of files whenever
  you want
• Restore those copies quickly and easily
• Share the files and the change s with other
  developers
• Integrate their changes into your files
Directed Acyclic Graph
Git Internals: Blobs


                                                    main.c


457aef 93f f 7f f bb289f 7e1384f 900679eac f 044a
Git Internals: Trees
Git Internals: Commits
Git Internals: Commits
Giting Started
•   mkdir new_proj       •   cd old_proj
•   cd new_proj          •   git init
•   git init             •   git add .
•   ...do some work...   •   git commit
•   git add .
•   git commit
The Staging Area
What's changed?
git status
On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working
directory)
#
#   modified:      index.php
#
What's changed? (cont)
git diff
diff --git a/index.php b/index.php
index 9e7353c..1764d3e 100644
--- a/index.php
+++ b/index.php
@@ -24,4 +24,5 @@
 require_once 'webroot'.DIRECTORY_SEPARATOR.'index.php';
-?>
 No newline at end of file
+echo 'an example change';
+?>
Birds Eye View
• git log
• gitk
  – a graphical view of your repository
• GitX
  – Mac OS X app for doing the above
  – also handy for commit review
  – prettier than gitk
Git Internals: Branches



branchna
   me



 HEAD
Branching
Branching
• Another great reason to use Version
  Control—particularly git
• “Your first idea is never your best idea”
• Branches give you the freedom to change
  things...whenever
Branching (cont)
• git branch experimental
  – creates a branch named 'experimental'
• git branch
  – shows a list of branches:
• git checkout experimental
  – switch to the new branch
The Staging Area (cont)
• All that happened in the same directory
  – sort of...
• Your version histories actually in the .git
  folder
• so, when you checkout a branch git
  changes all the files outside of .git to
  match that branches content
• git it?
Put it back together again
• git checkout master
• git merge experimental

• if all went well, then your done
• if not:

• git mergetool
• git commit -a
Git Internals: Remotes



branchna
   me
           remotes/server/na
                 me
 HEAD
Local vs. Remote
Multiple Workflows
Centralized
Integration Manager
Benevolent Dictator
Where to Share
=
Other Hosting Options
• Public Only        • Public and Private
  – repo.or.cz         – GitHub.com
  – Gitorious.org      – CodaSet.com
• Private Only
  – Unfuddle.com
  – codebasehq.com
How to Contribute
1.   Fork a repository at GitHub
2.   Clone and connect your local repository
3.   Write tests, implement functionality
4.   Commit your local changes
5.   Push your changes to your fork
6.   Make a pull request
7.   Profit!!
git log
• Kudos to Sc o tt Cha c o n who made
   – http://git-scm.com
   – http://whygitisbetterthanx.com
• And to Mic ha e l Ha rtl
   – for Building the Insoshi Social Network
• Wikipedia too.

nick@quaran.to                 byoung@bigbluehat.com
http://litanyagainstfear.com   http://bigbluehat.com

Contenu connexe

Tendances

Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 

Tendances (20)

Github
GithubGithub
Github
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git 101
Git 101Git 101
Git 101
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
Git and GitHub crash course
Git and GitHub crash courseGit and GitHub crash course
Git and GitHub crash course
 
GitHub
GitHubGitHub
GitHub
 
git and github
git and githubgit and github
git and github
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Inside GitHub
Inside GitHubInside GitHub
Inside GitHub
 
Git basic
Git basicGit basic
Git basic
 

Similaire à The Basics of Open Source Collaboration With Git and GitHub

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
Robert Lee-Cann
 
Git Introductive
Git IntroductiveGit Introductive
Git Introductive
Adham Saad
 

Similaire à The Basics of Open Source Collaboration With Git and GitHub (20)

Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
 
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
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
11 git version control
11 git version control11 git version control
11 git version control
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git tips and tricks
Git   tips and tricksGit   tips and tricks
Git tips and tricks
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git Introductive
Git IntroductiveGit Introductive
Git Introductive
 

Dernier

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
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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...
 

The Basics of Open Source Collaboration With Git and GitHub

  • 1. Open Source Collaboration with Git and GitHub by Benjamin Young adapted from work by Nick Quaranto
  • 2. whoami • President of BigBlueHat – a web manufacturing company – we build web stuff • We built BlueInk – a content management system • Building sites since the late 90's – I remember Netscape 3
  • 3. Ve rs io n Co ntro l c o uld s a v e y o ur life .
  • 4. Or a t le a s t y o ur jo b/pro je c t/ide a / s a nity /g pa
  • 5. The Basics • Keep “backup” copies of files whenever you want • Restore those copies quickly and easily • Share the files and the change s with other developers • Integrate their changes into your files
  • 6.
  • 7.
  • 9. Git Internals: Blobs main.c 457aef 93f f 7f f bb289f 7e1384f 900679eac f 044a
  • 13. Giting Started • mkdir new_proj • cd old_proj • cd new_proj • git init • git init • git add . • ...do some work... • git commit • git add . • git commit
  • 15. What's changed? git status On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: index.php #
  • 16. What's changed? (cont) git diff diff --git a/index.php b/index.php index 9e7353c..1764d3e 100644 --- a/index.php +++ b/index.php @@ -24,4 +24,5 @@ require_once 'webroot'.DIRECTORY_SEPARATOR.'index.php'; -?> No newline at end of file +echo 'an example change'; +?>
  • 17. Birds Eye View • git log • gitk – a graphical view of your repository • GitX – Mac OS X app for doing the above – also handy for commit review – prettier than gitk
  • 20. Branching • Another great reason to use Version Control—particularly git • “Your first idea is never your best idea” • Branches give you the freedom to change things...whenever
  • 21. Branching (cont) • git branch experimental – creates a branch named 'experimental' • git branch – shows a list of branches: • git checkout experimental – switch to the new branch
  • 22. The Staging Area (cont) • All that happened in the same directory – sort of... • Your version histories actually in the .git folder • so, when you checkout a branch git changes all the files outside of .git to match that branches content • git it?
  • 23. Put it back together again • git checkout master • git merge experimental • if all went well, then your done • if not: • git mergetool • git commit -a
  • 24. Git Internals: Remotes branchna me remotes/server/na me HEAD
  • 31.
  • 32. =
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38. Other Hosting Options • Public Only • Public and Private – repo.or.cz – GitHub.com – Gitorious.org – CodaSet.com • Private Only – Unfuddle.com – codebasehq.com
  • 39. How to Contribute 1. Fork a repository at GitHub 2. Clone and connect your local repository 3. Write tests, implement functionality 4. Commit your local changes 5. Push your changes to your fork 6. Make a pull request 7. Profit!!
  • 40. git log • Kudos to Sc o tt Cha c o n who made – http://git-scm.com – http://whygitisbetterthanx.com • And to Mic ha e l Ha rtl – for Building the Insoshi Social Network • Wikipedia too. nick@quaran.to byoung@bigbluehat.com http://litanyagainstfear.com http://bigbluehat.com