SlideShare uma empresa Scribd logo
1 de 61
G it’s the way
   to do it!
G it’s the way
           to do it!




 A Beginnerʼs Guide to
Version Control with Git.
What is
Version Control?
What is
      Version Control?
• Allows you to keep a history of every change
  within a project.
What is
      Version Control?
• Allows you to keep a history of every change
  within a project.
• Allows multiple people to collaborate on the
  same project, without evil stuff happening.
What is
        Version Control?
• Allows you to keep a history of every change
    within a project.
• Allows multiple people to collaborate on the
    same project, without evil stuff happening.
•   All files (and historical versions) are backed-
    up automatically.
What is Git?
What is Git?


• Created by Linus Torvalds.
What is Git?


• Created by Linus Torvalds.
• Run locally, with no server needed.
What is Git?


• Created by Linus Torvalds.
• Run locally, with no server needed.
• Works offline.
What is Git?


• Created by Linus Torvalds.
• Run locally, with no server needed.
• Works offline.
• Command-line or GUI.
Installation
Installation

• Windows:
  http://code.google.com/p/msysgit/
• Mac OSX:
  http://code.google.com/p/git-osx-installer/
• Linux:
  Packages available for most distros, or build from
  source.
Configuring Git

• Configure your name and email address.
  git config --global user.name = ‘leeky’

  git config --global user.email = ‘leeky@leeky.org.uk’



• Using ‘--global’ makes these the default value
  for all projects.
Starting a New
Git-Managed Project
Starting a New
   Git-Managed Project

• Create directory for project.
Starting a New
    Git-Managed Project

• Create directory for project.
•   cd   into project directory.
Starting a New
    Git-Managed Project

• Create directory for project.
•   cd   into project directory.

• Type git init to initialise Git for this
    project.
Starting a New
     Git-Managed Project

• Create directory for project.
•   cd   into project directory.

• Type git init to initialise Git for this
    project.
    Initialized empty Git repository in /git/demo/.git/
Terminology

• Repository - where the current and historical
  file data is stored.
• Working copy - the local copy of files from a
  repository, at a specific time or revision.
• Commit - copy files from your working copy to
  the repository.These changes are stored together
  as an individual revision.
Basic Git Workflow
1. Add, edit and delete files in your project in
   the normal way, using your favourite editor
   (e.g. TextMate,Vi, Dreamweaver etc).
2. Tell Git which file(s) are to be saved into the
   new commit using git add
3. Commit files to repository using git   commit.
Demo
Git Commands

•   git status   - View status of working copy.
•   git add   - Add unstaged changes.
    - git   add {filename} {filename} ...
    - git   add .

• git commit     - Commit changes to repository.
    - git   commit -m “{message}”
More Git Commands

•   git diff- Shows differences between
    working copy and last revision.
•   git log    - Shows the history log.
    - git   log {filename}   - Restrict log to file(s)
• git blame {filename}   - Shows when/who
    made changes to a file.
Git GUI




• Launch by running git gui in your project’s
  directory.
• Gives you ability to add files and create
  commits without using the command line!
Gitk




• Launch by running gitk in your project’s
  directory.
• Allows you to browse the entire history of
  your project and see when and by whom
  files were changed.
Gitk




• Launch by running gitk in your project’s
  directory.
• Allows you to browse the entire history of
  your project and see when and by whom
  files were changed.
TextMate
TextMate




    Git Bundle                    ProjectPlus
http://www.gitorious.org/     http://www.ciaranwal.sh/
  projects/git-tmbundle     2008/08/05/textmate-plug-in-
                                     projectplus
Branching
Branching

• Allows experimental features to be
  developed separately, without affecting stable
  code.
Branching

• Allows experimental features to be
  developed separately, without affecting stable
  code.
• Branches can be easily created and later
  merged together.
Branching

• Allows experimental features to be
   developed separately, without affecting stable
   code.
• Branches can be easily created and later
   merged together.

Master     Master
Branching

• Allows experimental features to be
   developed separately, without affecting stable
   code.
• Branches can be easily created and later
   merged together.

Master     Master

            git branch   Branch   Branch
Branching

• Allows experimental features to be
   developed separately, without affecting stable
   code.
• Branches can be easily created and later
   merged together.

Master     Master        Master   Master

            git branch   Branch   Branch
Branching

• Allows experimental features to be
   developed separately, without affecting stable
   code.
• Branches can be easily created and later
   merged together.

Master     Master        Master   Master      Master

            git branch   Branch   Branch   git merge
Working with Branches
Working with Branches
•   git branch

    - git   branch   - View branches.
    - git   branch   {branchname} - Create a new
      branch.
Working with Branches
•   git branch

    - git   branch   - View branches.
    - git   branch   {branchname} - Create a new
      branch.
•   git checkout {branchname}     - Switch to
    another branch.
Working with Branches
•   git branch

    - git   branch   - View branches.
    - git   branch   {branchname} - Create a new
      branch.
•   git checkout {branchname}     - Switch to
    another branch.
• git checkout -b {branchname}   - Create new
    branch and immediately switch to it.
Merging Branches
Merging Branches


Merge otherbranch into mainbranch:
Merging Branches


Merge otherbranch into mainbranch:
•   git checkout {mainbranch}
Merging Branches


Merge otherbranch into mainbranch:
•   git checkout {mainbranch}

•   git merge {otherbranch}
Merging Branches


Merge otherbranch into mainbranch:
•   git checkout {mainbranch}

•   git merge {otherbranch}

•   git merge {otherbranch} -m “commit msg”
Conflict Resolution
Conflict Resolution

CONFLICT (add/add): Merge conflict in foo

Automatic merge failed; fix conflicts and
then commit the result.
Conflict Resolution



     D O N ʼT
CONFLICT (add/add): Merge conflict in foo




          IC  !
Automatic merge failed; fix conflicts and
then commit the result.


        N
     PA
Conflict Resolution

# On branch master
# Your branch and 'origin/master' have   diverged,
# and have 1 and 1 different commit(s)   each, respectively.
#
# Changed but not updated:
#   (use "git add <file>..." to update   what will be committed)
#
#	 unmerged:   foo
# no changes added to commit (use "git   add" and/or "git commit -a")
Conflict Resolution
la la la
<<<<<<< HEAD:foo
wish


dog
cow
cat
=======
moo cow

fish

>>>>>>> 0cb13d1ceabf7e579b423815d8314fca0475ab7f:foo
Conflict Resolution



• Merge manually.
• Commit the merge.
Collaborating with Others
Collaborating with Others

Clone an existing repository:
•   git clone {anotherpath} {directory}

•   git clone {url} {directory}

Manage connections to remote repositories:
•   git remote

    -    git remote add {name} {url}
Pushing & Pulling
Pushing & Pulling
Pull (download) from another repository:
•   git pull {remotename} {remotebranch}

•   git pull
Pushing & Pulling
Pull (download) from another repository:
•   git pull {remotename} {remotebranch}

•   git pull



Push (upload) to another repository:
•   git push {remotename} {remotebranch}

•   git push
Third-party Git Hosts


• GitHub - http://www.github.com
• Gitorious - http://www.gitorious.org/
• Unfuddle - http://www.unfuddle.com
GitHub Demo
Resources

• Git for Designers -
  http://hoth.entp.com/output/git_for_designers.html
• Peepcode Screencast ($9) -
  https://peepcode.com/products/git
• Hosting your own repositories -
  http://scie.nti.st/2007/11/14/hosting-git-
  repositories-the-easy-and-secure-way
Thanks for listening.
     Robert Lee-Cann
      Lee-Cann Creative

      hello@lee-cann.com

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Advanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesAdvanced Git: Functionality and Features
Advanced Git: Functionality and Features
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Migrating To GitHub
Migrating To GitHub  Migrating To GitHub
Migrating To GitHub
 
Github
GithubGithub
Github
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
 
2017 jenkins world
2017 jenkins world2017 jenkins world
2017 jenkins world
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on 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
 
Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshare
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and Devpost
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for Documentation
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 

Destaque

01 - Introduction to Version Control
01 - Introduction to Version Control01 - Introduction to Version Control
01 - Introduction to Version Control
Sergii Shmarkatiuk
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
Joel Krebs
 

Destaque (14)

Version Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part IVersion Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part I
 
Introduzione a Git
Introduzione a GitIntroduzione a Git
Introduzione a Git
 
Version control
Version controlVersion control
Version control
 
01 - Introduction to Version Control
01 - Introduction to Version Control01 - Introduction to Version Control
01 - Introduction to Version Control
 
Joget Workflow v5 Training Slides - Module 12 - Version Control
Joget Workflow v5 Training Slides - Module 12 - Version ControlJoget Workflow v5 Training Slides - Module 12 - Version Control
Joget Workflow v5 Training Slides - Module 12 - Version Control
 
A brief introduction to version control systems
A brief introduction to version control systemsA brief introduction to version control systems
A brief introduction to version control systems
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
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 Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git basics
Git basicsGit basics
Git basics
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 

Semelhante a Beginner's Guide to Version Control with Git

3 Git
3 Git3 Git

Semelhante a Beginner's Guide to Version Control with Git (20)

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-presentation.pdf
git-presentation.pdfgit-presentation.pdf
git-presentation.pdf
 
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 and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
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
 
3 Git
3 Git3 Git
3 Git
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
git and github
git and githubgit and github
git and github
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git 101
Git 101Git 101
Git 101
 
Git tips and tricks
Git   tips and tricksGit   tips and tricks
Git tips and tricks
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levels
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 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
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Beginner's Guide to Version Control with Git

  • 1.
  • 2. G it’s the way to do it!
  • 3. G it’s the way to do it! A Beginnerʼs Guide to Version Control with Git.
  • 5. What is Version Control? • Allows you to keep a history of every change within a project.
  • 6. What is Version Control? • Allows you to keep a history of every change within a project. • Allows multiple people to collaborate on the same project, without evil stuff happening.
  • 7. What is Version Control? • Allows you to keep a history of every change within a project. • Allows multiple people to collaborate on the same project, without evil stuff happening. • All files (and historical versions) are backed- up automatically.
  • 9. What is Git? • Created by Linus Torvalds.
  • 10. What is Git? • Created by Linus Torvalds. • Run locally, with no server needed.
  • 11. What is Git? • Created by Linus Torvalds. • Run locally, with no server needed. • Works offline.
  • 12. What is Git? • Created by Linus Torvalds. • Run locally, with no server needed. • Works offline. • Command-line or GUI.
  • 14. Installation • Windows: http://code.google.com/p/msysgit/ • Mac OSX: http://code.google.com/p/git-osx-installer/ • Linux: Packages available for most distros, or build from source.
  • 15. Configuring Git • Configure your name and email address. git config --global user.name = ‘leeky’ git config --global user.email = ‘leeky@leeky.org.uk’ • Using ‘--global’ makes these the default value for all projects.
  • 17. Starting a New Git-Managed Project • Create directory for project.
  • 18. Starting a New Git-Managed Project • Create directory for project. • cd into project directory.
  • 19. Starting a New Git-Managed Project • Create directory for project. • cd into project directory. • Type git init to initialise Git for this project.
  • 20. Starting a New Git-Managed Project • Create directory for project. • cd into project directory. • Type git init to initialise Git for this project. Initialized empty Git repository in /git/demo/.git/
  • 21. Terminology • Repository - where the current and historical file data is stored. • Working copy - the local copy of files from a repository, at a specific time or revision. • Commit - copy files from your working copy to the repository.These changes are stored together as an individual revision.
  • 22. Basic Git Workflow 1. Add, edit and delete files in your project in the normal way, using your favourite editor (e.g. TextMate,Vi, Dreamweaver etc). 2. Tell Git which file(s) are to be saved into the new commit using git add 3. Commit files to repository using git commit.
  • 23. Demo
  • 24. Git Commands • git status - View status of working copy. • git add - Add unstaged changes. - git add {filename} {filename} ... - git add . • git commit - Commit changes to repository. - git commit -m “{message}”
  • 25. More Git Commands • git diff- Shows differences between working copy and last revision. • git log - Shows the history log. - git log {filename} - Restrict log to file(s) • git blame {filename} - Shows when/who made changes to a file.
  • 26. Git GUI • Launch by running git gui in your project’s directory. • Gives you ability to add files and create commits without using the command line!
  • 27. Gitk • Launch by running gitk in your project’s directory. • Allows you to browse the entire history of your project and see when and by whom files were changed.
  • 28. Gitk • Launch by running gitk in your project’s directory. • Allows you to browse the entire history of your project and see when and by whom files were changed.
  • 30. TextMate Git Bundle ProjectPlus http://www.gitorious.org/ http://www.ciaranwal.sh/ projects/git-tmbundle 2008/08/05/textmate-plug-in- projectplus
  • 32. Branching • Allows experimental features to be developed separately, without affecting stable code.
  • 33. Branching • Allows experimental features to be developed separately, without affecting stable code. • Branches can be easily created and later merged together.
  • 34. Branching • Allows experimental features to be developed separately, without affecting stable code. • Branches can be easily created and later merged together. Master Master
  • 35. Branching • Allows experimental features to be developed separately, without affecting stable code. • Branches can be easily created and later merged together. Master Master git branch Branch Branch
  • 36. Branching • Allows experimental features to be developed separately, without affecting stable code. • Branches can be easily created and later merged together. Master Master Master Master git branch Branch Branch
  • 37. Branching • Allows experimental features to be developed separately, without affecting stable code. • Branches can be easily created and later merged together. Master Master Master Master Master git branch Branch Branch git merge
  • 39. Working with Branches • git branch - git branch - View branches. - git branch {branchname} - Create a new branch.
  • 40. Working with Branches • git branch - git branch - View branches. - git branch {branchname} - Create a new branch. • git checkout {branchname} - Switch to another branch.
  • 41. Working with Branches • git branch - git branch - View branches. - git branch {branchname} - Create a new branch. • git checkout {branchname} - Switch to another branch. • git checkout -b {branchname} - Create new branch and immediately switch to it.
  • 44. Merging Branches Merge otherbranch into mainbranch: • git checkout {mainbranch}
  • 45. Merging Branches Merge otherbranch into mainbranch: • git checkout {mainbranch} • git merge {otherbranch}
  • 46. Merging Branches Merge otherbranch into mainbranch: • git checkout {mainbranch} • git merge {otherbranch} • git merge {otherbranch} -m “commit msg”
  • 48. Conflict Resolution CONFLICT (add/add): Merge conflict in foo Automatic merge failed; fix conflicts and then commit the result.
  • 49. Conflict Resolution D O N ʼT CONFLICT (add/add): Merge conflict in foo IC ! Automatic merge failed; fix conflicts and then commit the result. N PA
  • 50. Conflict Resolution # On branch master # Your branch and 'origin/master' have diverged, # and have 1 and 1 different commit(s) each, respectively. # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # unmerged: foo # no changes added to commit (use "git add" and/or "git commit -a")
  • 51. Conflict Resolution la la la <<<<<<< HEAD:foo wish dog cow cat ======= moo cow fish >>>>>>> 0cb13d1ceabf7e579b423815d8314fca0475ab7f:foo
  • 52. Conflict Resolution • Merge manually. • Commit the merge.
  • 54. Collaborating with Others Clone an existing repository: • git clone {anotherpath} {directory} • git clone {url} {directory} Manage connections to remote repositories: • git remote - git remote add {name} {url}
  • 56. Pushing & Pulling Pull (download) from another repository: • git pull {remotename} {remotebranch} • git pull
  • 57. Pushing & Pulling Pull (download) from another repository: • git pull {remotename} {remotebranch} • git pull Push (upload) to another repository: • git push {remotename} {remotebranch} • git push
  • 58. Third-party Git Hosts • GitHub - http://www.github.com • Gitorious - http://www.gitorious.org/ • Unfuddle - http://www.unfuddle.com
  • 60. Resources • Git for Designers - http://hoth.entp.com/output/git_for_designers.html • Peepcode Screencast ($9) - https://peepcode.com/products/git • Hosting your own repositories - http://scie.nti.st/2007/11/14/hosting-git- repositories-the-easy-and-secure-way
  • 61. Thanks for listening. Robert Lee-Cann Lee-Cann Creative hello@lee-cann.com

Notas do Editor

  1. Hello, my name is Robert Lee-Cann and I&amp;#x2019;m a web developer. In this talk I&amp;#x2019;ll be introducing you to the basic concepts of version control - what it is, how it works and the benefits it will bring to your development workflow.
  2. Hello, my name is Robert Lee-Cann and I&amp;#x2019;m a web developer. In this talk I&amp;#x2019;ll be introducing you to the basic concepts of version control - what it is, how it works and the benefits it will bring to your development workflow.
  3. So what exactly IS version control?
  4. So what exactly IS version control?
  5. So what exactly IS version control?