SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
#BeeTalks

Starting with
Git & GitHub

Nicolás Tourné @nicotourne
CTO of BeeReal
Tandil, Argentina - 2013
Agenda

•
•
•
•
•

What’s a Version Control System?
What the heck is Git?
Some Git commands

What’s about GitHub?
Git in Action!
What’s a Version Control System?

“An application that allows you to
record changes to your codebase in a
structured and controlled fashion.”
Why do I need that?

•
•
•

Makes it way easier to undo errors / roll
back to earlier versions of code
Makes it way easier to share a codebase
between developers without creating
conflicts
Makes it way easier to deploy changes
from development to staging or production
environments
Popular Version Control Systems

•
•
•
•
•
•

CVS - Concurrent Version System
SVN - SubVersioN
Git
Mercurial
Bazaar
LibreSource
What the heck is Git?

•
•
•
•
•

Distributed Source Control system
Open source, free (GNU GPL V2)
Originally developed by Linus Torvalds for
the development of the Linux Kernel in 2005
Focus on speed and efficiency
Quite a unique design and therefore
sometimes a bit scary and difficult to
understand
What the heck is Git?

•
•
•
•

Save snapshots, no differences
Branching (lightweight & fast)
Automatic merge of files

Used on personal or very large projects, and
for all size of teams
Distributed Development

•

•
•

Every Git working directory contains the
complete repository and history and full
revision tracking capabilities
You’re not dependent on a central server
and you don’t have to be online
It’s extremely fast - much faster than SVN,
CVS and other systems
Centralized vs Distributed
Development
SVN / CVS - Centralized development

Central

John

Peter

Bob

Carl
Centralized vs Distributed
Development
Git - Distributed development

John
Peter
Bob

Carl

Central
A Git Sample
1. A new git is initialized as a remote
repository
John

Remote repository

master
C0

Peter
A Git Sample
2. John and Peter clone the git repository
John

Remote repository

Peter

master

master

master

C0

C0

C0
A Git Sample
3. John does a commit
John

Remote repository

Peter

master

master

master

C1

C0

C0

C0
A Git Sample
4. John does a push
John

Remote repository

Peter

master

master

master

C1

C1

C0

C0

C0
A Git Sample
5. Peter does a pull
John

Remote repository

Peter

master

master

master

C1

C1

C1

C0

C0

C0
A Git Sample
6. John does a commit & push
John

Remote repository

Peter

master

master

master

C2

C2

C1

C1

C0

C0

C0

C0
A Git Sample
7. Peter does a commit
John

Remote repository

Peter

master

master

master

C2

C2

C3

C1

C1

C1

C0

C0

C0
A Git Sample
8. Peter does a pull (fetch & merge)
John

Remote repository

Peter

master

master

master

C2

C2

C4

C1

C1

C0

C0

C2

C3
C1
C0
A Git Sample
9. Peter does a push
John

Remote repository

Peter

master

master

master

C2

C4

C4

C1
C0

C2

C3

C2

C3

C1

C1

C0

C0
A Git Sample
10. John does a pull
John

Remote repository

Peter

master

master

master

C4

C4

C4

C2

C3

C2

C3

C2

C3

C1

C1

C1

C0

C0

C0
Git Commands
Getting and Creating projects
init
To create a git repository from an existing
directory of files
$ git init

clone
If you want to get a copy of a project, you
need to clone it
$ git clone [url]
Git Commands
Basic Snapshotting
git add
You have to add file contents to your staging
area before you can commit them
$ git add index.php

git status
View the status of your files in the working
directory and staging area
$ git status
Git Commands
Basic Snapshotting
git diff
Shows diff of what is staged and what is
modified but unstaged
$ git diff

git commit
Records a snapshot of the staging area
$ git commit -m “My comment”
Git Commands
Basic Snapshotting
git reset
Undo changed and commits
$ git reset

git rm
Remove files from the staging area
$ git rm index.php
Git Commands
Basic Snapshotting
git mv
Git doesn’t track file renames
$ git mv index.php index.html

git stash
Save changes made in the current index and
working directory for later
$ git stash
Git Commands
Branching and Merging
git branch
List, create and manage branches
$ git branch
$ git branch QA

git checkout
Switch to a new branch context
$ git checkout QA
$ git checkout -b live
Git Commands
Branching and Merging
git merge
Merge a branch context into your current one
$ git branch
$ git merge QA

git log
Show commit history of a branch
$ git log
Git Commands
Branching and Merging
git tag
Tag a point in history as important
$ git tag -a v1.0
Git Commands
Sharing and Updating Projects
git fetch
Download new branches and data from
remote repository
$ git fetch

git pull
Fetch from a remote repo and try to merge
into the current branch
$ git pull
Git Commands
Sharing and Updating Projects
git push
Push your new branches and data to a remote
repository
$ git push
What's about GitHub?

•
•
•

It’s a Git repository hosting service… but it
adds many of its own features
While Git is a command line tool, GitHub
provides a web-based graphical interface
It also provides access control and several
collaboration features, such as wikis and
basic task management tools
What's about GitHub?

•
•
•

By default, all projects are public and free. In
you want a private project, then pay
You can clone any public repository, follow
projects and developers, post comments, etc
It’s becoming the Facebook’s for developers
Git in Action!
Go to your computer and start playing...
1. Create a new repository on GitHub
2. Clone this repository
3. Add new files
4. Commit and push them
5. Create a new branch and merge files
Thank you
for your attention!
Questions?
Just tweet me @nicotourne
or mail me at ntourne@beerealit.com
beerealit.com
More info at...
Official Git site
http://git-scm.com
Some slides
http://www.slideshare.net/jomikr/quick-introduction-to-git
http://www.slideshare.net/reallyordinary/intro-to-git-for-drupal-7

http://www.slideshare.net/anildigital/git-introduction
http://www.slideshare.net/chacon/getting-git
Git commands

http://gitref.org/basic
GitHub site
http://github.com

Contenu connexe

Tendances

Learning git
Learning gitLearning git
Learning gitSid Anand
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
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 GitE Carter
 
Git Terminologies
Git TerminologiesGit Terminologies
Git TerminologiesYash
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and GithubHouari ZEGAI
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsCarl Brown
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagramsDilum Navanjana
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction TutorialThomas Rausch
 

Tendances (20)

Learning git
Learning gitLearning git
Learning git
 
Github basics
Github basicsGithub basics
Github basics
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
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 Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git basics
Git basicsGit basics
Git basics
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 

Similaire à Starting with Git & GitHub

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 GitHubKim Moir
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostAndrew Kerr
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network EngineersJoel W. King
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptxtnscharishma
 
O365Con18 - Git and GitHub - Rick van Rousselt
O365Con18 - Git and GitHub - Rick van RousseltO365Con18 - Git and GitHub - Rick van Rousselt
O365Con18 - Git and GitHub - Rick van RousseltNCCOMMS
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitColin Su
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open SourceLorna Mitchell
 
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
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | EdurekaEdureka!
 
Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013Sunny Sharma
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitRick Umali
 

Similaire à Starting with Git & GitHub (20)

Github
GithubGithub
Github
 
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
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Git presentation
Git presentationGit presentation
Git presentation
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and Devpost
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
O365Con18 - Git and GitHub - Rick van Rousselt
O365Con18 - Git and GitHub - Rick van RousseltO365Con18 - Git and GitHub - Rick van Rousselt
O365Con18 - Git and GitHub - Rick van Rousselt
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open Source
 
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 overview
Git overviewGit overview
Git overview
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
3 Git
3 Git3 Git
3 Git
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
 
Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 

Dernier

The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 

Dernier (20)

The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 

Starting with Git & GitHub

  • 1. #BeeTalks Starting with Git & GitHub Nicolás Tourné @nicotourne CTO of BeeReal Tandil, Argentina - 2013
  • 2. Agenda • • • • • What’s a Version Control System? What the heck is Git? Some Git commands What’s about GitHub? Git in Action!
  • 3. What’s a Version Control System? “An application that allows you to record changes to your codebase in a structured and controlled fashion.”
  • 4. Why do I need that? • • • Makes it way easier to undo errors / roll back to earlier versions of code Makes it way easier to share a codebase between developers without creating conflicts Makes it way easier to deploy changes from development to staging or production environments
  • 5. Popular Version Control Systems • • • • • • CVS - Concurrent Version System SVN - SubVersioN Git Mercurial Bazaar LibreSource
  • 6. What the heck is Git? • • • • • Distributed Source Control system Open source, free (GNU GPL V2) Originally developed by Linus Torvalds for the development of the Linux Kernel in 2005 Focus on speed and efficiency Quite a unique design and therefore sometimes a bit scary and difficult to understand
  • 7. What the heck is Git? • • • • Save snapshots, no differences Branching (lightweight & fast) Automatic merge of files Used on personal or very large projects, and for all size of teams
  • 8. Distributed Development • • • Every Git working directory contains the complete repository and history and full revision tracking capabilities You’re not dependent on a central server and you don’t have to be online It’s extremely fast - much faster than SVN, CVS and other systems
  • 9. Centralized vs Distributed Development SVN / CVS - Centralized development Central John Peter Bob Carl
  • 10. Centralized vs Distributed Development Git - Distributed development John Peter Bob Carl Central
  • 11. A Git Sample 1. A new git is initialized as a remote repository John Remote repository master C0 Peter
  • 12. A Git Sample 2. John and Peter clone the git repository John Remote repository Peter master master master C0 C0 C0
  • 13. A Git Sample 3. John does a commit John Remote repository Peter master master master C1 C0 C0 C0
  • 14. A Git Sample 4. John does a push John Remote repository Peter master master master C1 C1 C0 C0 C0
  • 15. A Git Sample 5. Peter does a pull John Remote repository Peter master master master C1 C1 C1 C0 C0 C0
  • 16. A Git Sample 6. John does a commit & push John Remote repository Peter master master master C2 C2 C1 C1 C0 C0 C0 C0
  • 17. A Git Sample 7. Peter does a commit John Remote repository Peter master master master C2 C2 C3 C1 C1 C1 C0 C0 C0
  • 18. A Git Sample 8. Peter does a pull (fetch & merge) John Remote repository Peter master master master C2 C2 C4 C1 C1 C0 C0 C2 C3 C1 C0
  • 19. A Git Sample 9. Peter does a push John Remote repository Peter master master master C2 C4 C4 C1 C0 C2 C3 C2 C3 C1 C1 C0 C0
  • 20. A Git Sample 10. John does a pull John Remote repository Peter master master master C4 C4 C4 C2 C3 C2 C3 C2 C3 C1 C1 C1 C0 C0 C0
  • 21. Git Commands Getting and Creating projects init To create a git repository from an existing directory of files $ git init clone If you want to get a copy of a project, you need to clone it $ git clone [url]
  • 22. Git Commands Basic Snapshotting git add You have to add file contents to your staging area before you can commit them $ git add index.php git status View the status of your files in the working directory and staging area $ git status
  • 23. Git Commands Basic Snapshotting git diff Shows diff of what is staged and what is modified but unstaged $ git diff git commit Records a snapshot of the staging area $ git commit -m “My comment”
  • 24. Git Commands Basic Snapshotting git reset Undo changed and commits $ git reset git rm Remove files from the staging area $ git rm index.php
  • 25. Git Commands Basic Snapshotting git mv Git doesn’t track file renames $ git mv index.php index.html git stash Save changes made in the current index and working directory for later $ git stash
  • 26. Git Commands Branching and Merging git branch List, create and manage branches $ git branch $ git branch QA git checkout Switch to a new branch context $ git checkout QA $ git checkout -b live
  • 27. Git Commands Branching and Merging git merge Merge a branch context into your current one $ git branch $ git merge QA git log Show commit history of a branch $ git log
  • 28. Git Commands Branching and Merging git tag Tag a point in history as important $ git tag -a v1.0
  • 29. Git Commands Sharing and Updating Projects git fetch Download new branches and data from remote repository $ git fetch git pull Fetch from a remote repo and try to merge into the current branch $ git pull
  • 30. Git Commands Sharing and Updating Projects git push Push your new branches and data to a remote repository $ git push
  • 31. What's about GitHub? • • • It’s a Git repository hosting service… but it adds many of its own features While Git is a command line tool, GitHub provides a web-based graphical interface It also provides access control and several collaboration features, such as wikis and basic task management tools
  • 32. What's about GitHub? • • • By default, all projects are public and free. In you want a private project, then pay You can clone any public repository, follow projects and developers, post comments, etc It’s becoming the Facebook’s for developers
  • 33. Git in Action! Go to your computer and start playing... 1. Create a new repository on GitHub 2. Clone this repository 3. Add new files 4. Commit and push them 5. Create a new branch and merge files
  • 34. Thank you for your attention! Questions? Just tweet me @nicotourne or mail me at ntourne@beerealit.com beerealit.com
  • 35. More info at... Official Git site http://git-scm.com Some slides http://www.slideshare.net/jomikr/quick-introduction-to-git http://www.slideshare.net/reallyordinary/intro-to-git-for-drupal-7 http://www.slideshare.net/anildigital/git-introduction http://www.slideshare.net/chacon/getting-git Git commands http://gitref.org/basic GitHub site http://github.com