SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagramsDilum Navanjana
 
Advanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesAdvanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesBrent Laster
 
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, TrivandrumAbhijitNarayan2
 
2017 jenkins world
2017 jenkins world2017 jenkins world
2017 jenkins worldBrent Laster
 
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 GitGeoff Hoffman
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHubVikram SV
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshareRakesh Sukumar
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHubDSCVSSUT
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostAndrew Kerr
 
GIT presentation
GIT presentationGIT presentation
GIT presentationNaim Latifi
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for DocumentationAnne Gentle
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 

Tendances (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
 

En vedette

Version Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part IVersion Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part ISergey Aganezov
 
01 - Introduction to Version Control
01 - Introduction to Version Control01 - Introduction to Version Control
01 - Introduction to Version ControlSergii Shmarkatiuk
 
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 ControlJoget Workflow
 
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 systemsTim Staley
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & GitCraig Smith
 
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 Version Control System
Git Version Control SystemGit Version Control System
Git Version Control SystemKMS Technology
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to gitJoel Krebs
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with GitLuigi De Russis
 

En vedette (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
 

Similaire à Beginner's Guide to Version Control 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 GitHubBigBlueHat
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdfTilton2
 
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 slideRaghavendraVattikuti1
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
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
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
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 levelsGorav Singal
 

Similaire à 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
 

Dernier

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Dernier (20)

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

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

Notes de l'éditeur

  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?