Fundamentals of Git

C
Fundamentals of Git
By Chris McKnight
March 26th, 2015
Overview
• History of Git
• Project setup
• Staging Changes and Committing
• Branching, Merging, and Rebasing
• Working with remotes
History of Git
• Linux kernel developers started using
BitKeeper1
• BitKeeper license revoked
• Linus Torvalds created Git in 2005
1http://git-scm.com/book/en/v2/Getting-Started-A-Short-History-of-Git
What is Git?
• Distributed revision control system
• Goals
• Efficiency
• Speed
• Non-linear workflows
Configure Git
• Install Git1
• Configure user settings
• git config --global user.name “John Doe”
• git config --global user.email
“jdoe@example.com”
• Configure line ending conversions (OS
dependent)2
1https://help.github.com/articles/set-up-git
2https://help.github.com/articles/dealing-with-line-endings
Project Setup
• New Project
• init
• Create a .gitignore file
• Create a .gitattributes file
(optional)
• stage changes
• commit
• Existing project (not on computer)
• clone from a remote
Staging Changes &
Committing
• Staging changes
• git add <path>
• git rm <path>
• git commit
• Unstage changes
• git reset
• Can also move the file pointer
of the current branch or
discard all changes using git
reset
Branching
• Default branch is called
master
• Lightweight pointer to a
commit
• Useful for work in
progress, features, and
bug fixes
Merging
• Integrates changes from one
branch to another
• Example: merging a feature
branch into master for
deployment
Rebasing
• Another method of integrating changes of a
branch into another branch
• Rewrites history
• Moves to common ancestor of the two
rebased branches
• Figures out diffs
• Moves commits from the current branch into
a temporary area
• Resets the current branch to the branch you
are rebasing from
• Applies commits from the temporary area
onto the current branch
• Usage
• Updating a feature branch with bugfix
changes
• Cleaning up a local feature branch before
pushing to a remote
Remotes
• Typically the main remote is named origin
• origin is not a special remote
• can have multiple remotes
• Another Git repository used for
collaboration
• Changes are pushed and pulled
A basic workflow
• Create a new project
• Stage files and commit
• Create a remote and push
• Iterative development by using branches,
merging and pushing changes
GUI Tools
• Sourcetree GUI (http://www.sourcetreeapp.com/)
• GitHub app
• https://windows.github.com
• https://mac.github.com
• Others available at http://git-scm.com/download/
gui/linux
Diff & Merge Tools
• Kaleidoscope for Mac (http://
www.kaleidoscopeapp.com)
• WinMerge for Windows (http://winmerge.org)
• Meld for Windows (http://meldmerge.org)
• Araxis Merge (http://www.araxis.com/merge)
Resources
• Pro Git Book (http://git-scm.com/book/en/v2)
• GitHub (https://help.github.com)
• Try Git (https://www.codeschool.com/courses/
try-git)
• Git Real (https://www.codeschool.com/courses/
git-real and https://www.codeschool.com/
courses/git-real-2)
1 of 15

Recommended

Git overview by
Git overviewGit overview
Git overviewGowarthini
59 views14 slides
Git theory by
Git   theoryGit   theory
Git theoryhariprasad1035
135 views15 slides
Introduction to git hub by
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
386 views17 slides
Git and GitHub | Concept about Git and GitHub Process | Git Process overview by
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
400 views21 slides
Git n git hub by
Git n git hubGit n git hub
Git n git hubJiwon Baek
531 views22 slides
Git tutorial git branches 20131206-Bryan by
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-BryanLearningTech
803 views28 slides

More Related Content

What's hot

Git with bitbucket by
Git with bitbucketGit with bitbucket
Git with bitbucketSuhas Shivaram
315 views12 slides
Version control git day03 by
Version control   git day03Version control   git day03
Version control git day03Gourav Varma
154 views8 slides
Git and GitHub workflows by
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflowsArthur Shvetsov
3K views31 slides
Git ops: Git based application deployment patterns for Kubernetes by
Git ops: Git based application deployment patterns for KubernetesGit ops: Git based application deployment patterns for Kubernetes
Git ops: Git based application deployment patterns for KubernetesShahidh K Muhammed
870 views14 slides
GitOps with Gitkube by
GitOps with GitkubeGitOps with Gitkube
GitOps with GitkubeTirumarai Selvan
247 views11 slides
Workshop on Git and GitHub by
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHubDSCVSSUT
260 views18 slides

What's hot(20)

Version control git day03 by Gourav Varma
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma154 views
Git ops: Git based application deployment patterns for Kubernetes by Shahidh K Muhammed
Git ops: Git based application deployment patterns for KubernetesGit ops: Git based application deployment patterns for Kubernetes
Git ops: Git based application deployment patterns for Kubernetes
Shahidh K Muhammed870 views
Workshop on Git and GitHub by DSCVSSUT
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT260 views
HacktoberFest-Git&GitHub by GDSCIIITBbsr
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
GDSCIIITBbsr186 views
Know the Science behind WorkFlows using Git & GitHhub by Edureka!
Know the Science behind WorkFlows using Git & GitHhubKnow the Science behind WorkFlows using Git & GitHhub
Know the Science behind WorkFlows using Git & GitHhub
Edureka!1.6K views
Git简介 by clvrobj
Git简介Git简介
Git简介
clvrobj417 views
Learn Git - For Beginners and Intermediate levels by Gorav Singal
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levels
Gorav Singal64 views
Using Git and BitBucket by Medhat Dawoud
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud21.4K views
Version control git day03 by Gourav Varma
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma22 views

Similar to Fundamentals of Git

Git 101: Git and GitHub for Beginners by
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners HubSpot
152.8K views37 slides
The Basics of Open Source Collaboration With Git and GitHub by
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
1K views40 slides
Git Workflow by
Git WorkflowGit Workflow
Git WorkflowGary Yeh
864 views27 slides
Introduction to Git for Network Engineers by
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network EngineersJoel W. King
865 views13 slides
Git for folk who like GUIs by
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
2.3K views18 slides
Beginner's Guide to Version Control with Git by
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
2K views61 slides

Similar to Fundamentals of Git(20)

Git 101: Git and GitHub for Beginners by HubSpot
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
HubSpot152.8K views
The Basics of Open Source Collaboration With Git and GitHub by BigBlueHat
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
BigBlueHat1K views
Git Workflow by Gary Yeh
Git WorkflowGit Workflow
Git Workflow
Gary Yeh864 views
Introduction to Git for Network Engineers by Joel W. King
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
Joel W. King865 views
Git for folk who like GUIs by Tim Osborn
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
Tim Osborn2.3K views
Beginner's Guide to Version Control with Git by Robert Lee-Cann
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
Robert Lee-Cann2K views
Git installation and configuration by Kishor Kumar
Git installation and configurationGit installation and configuration
Git installation and configuration
Kishor Kumar722 views
Git One Day Training Notes by glen_a_smith
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith3.5K views
Git Tutorial I by Jim Yeh
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh1.2K views
Make Git Understand Excel Workbooks - Eusprig 2018 by Björn Stiel
Make Git Understand Excel Workbooks - Eusprig 2018Make Git Understand Excel Workbooks - Eusprig 2018
Make Git Understand Excel Workbooks - Eusprig 2018
Björn Stiel190 views
ePOM - Fundamentals of Research Software Development - Code Version Control by Giuseppe Masetti
ePOM - Fundamentals of Research Software Development - Code Version ControlePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version Control
Giuseppe Masetti3.5K views
O365Con18 - Git and GitHub - Rick van Rousselt by NCCOMMS
O365Con18 - Git and GitHub - Rick van RousseltO365Con18 - Git and GitHub - Rick van Rousselt
O365Con18 - Git and GitHub - Rick van Rousselt
NCCOMMS62 views
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1) by Ahmed El-Arabawy
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Ahmed El-Arabawy862 views

Recently uploaded

Understanding HTML terminology by
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminologyartembondar5
8 views8 slides
Top-5-production-devconMunich-2023-v2.pptx by
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptxTier1 app
9 views42 slides
University of Borås-full talk-2023-12-09.pptx by
University of Borås-full talk-2023-12-09.pptxUniversity of Borås-full talk-2023-12-09.pptx
University of Borås-full talk-2023-12-09.pptxMahdi_Fahmideh
12 views51 slides
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... by
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...Stefan Wolpers
44 views38 slides
Winter Projects GDSC IITK by
Winter Projects GDSC IITKWinter Projects GDSC IITK
Winter Projects GDSC IITKSahilSingh368445
416 views60 slides
Ports-and-Adapters Architecture for Embedded HMI by
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIBurkhard Stubert
35 views19 slides

Recently uploaded(20)

Understanding HTML terminology by artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar58 views
Top-5-production-devconMunich-2023-v2.pptx by Tier1 app
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app9 views
University of Borås-full talk-2023-12-09.pptx by Mahdi_Fahmideh
University of Borås-full talk-2023-12-09.pptxUniversity of Borås-full talk-2023-12-09.pptx
University of Borås-full talk-2023-12-09.pptx
Mahdi_Fahmideh12 views
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... by Stefan Wolpers
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
Stefan Wolpers44 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert35 views
Transport Management System - Shipment & Container Tracking by Freightoscope
Transport Management System - Shipment & Container TrackingTransport Management System - Shipment & Container Tracking
Transport Management System - Shipment & Container Tracking
Freightoscope 6 views
Automated Testing of Microsoft Power BI Reports by RTTS
Automated Testing of Microsoft Power BI ReportsAutomated Testing of Microsoft Power BI Reports
Automated Testing of Microsoft Power BI Reports
RTTS11 views
Google Solutions Challenge 2024 Talk pdf by MohdAbdulAleem4
Google Solutions Challenge 2024 Talk pdfGoogle Solutions Challenge 2024 Talk pdf
Google Solutions Challenge 2024 Talk pdf
MohdAbdulAleem434 views
Streamlining Your Business Operations with Enterprise Application Integration... by Flexsin
Streamlining Your Business Operations with Enterprise Application Integration...Streamlining Your Business Operations with Enterprise Application Integration...
Streamlining Your Business Operations with Enterprise Application Integration...
Flexsin 5 views
Advanced API Mocking Techniques Using Wiremock by Dimpy Adhikary
Advanced API Mocking Techniques Using WiremockAdvanced API Mocking Techniques Using Wiremock
Advanced API Mocking Techniques Using Wiremock
Dimpy Adhikary5 views
Introduction to Git Source Control by John Valentino
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
John Valentino8 views
aATP - New Correlation Confirmation Feature.pptx by EsatEsenek1
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptx
EsatEsenek1222 views

Fundamentals of Git

  • 1. Fundamentals of Git By Chris McKnight March 26th, 2015
  • 2. Overview • History of Git • Project setup • Staging Changes and Committing • Branching, Merging, and Rebasing • Working with remotes
  • 3. History of Git • Linux kernel developers started using BitKeeper1 • BitKeeper license revoked • Linus Torvalds created Git in 2005 1http://git-scm.com/book/en/v2/Getting-Started-A-Short-History-of-Git
  • 4. What is Git? • Distributed revision control system • Goals • Efficiency • Speed • Non-linear workflows
  • 5. Configure Git • Install Git1 • Configure user settings • git config --global user.name “John Doe” • git config --global user.email “jdoe@example.com” • Configure line ending conversions (OS dependent)2 1https://help.github.com/articles/set-up-git 2https://help.github.com/articles/dealing-with-line-endings
  • 6. Project Setup • New Project • init • Create a .gitignore file • Create a .gitattributes file (optional) • stage changes • commit • Existing project (not on computer) • clone from a remote
  • 7. Staging Changes & Committing • Staging changes • git add <path> • git rm <path> • git commit • Unstage changes • git reset • Can also move the file pointer of the current branch or discard all changes using git reset
  • 8. Branching • Default branch is called master • Lightweight pointer to a commit • Useful for work in progress, features, and bug fixes
  • 9. Merging • Integrates changes from one branch to another • Example: merging a feature branch into master for deployment
  • 10. Rebasing • Another method of integrating changes of a branch into another branch • Rewrites history • Moves to common ancestor of the two rebased branches • Figures out diffs • Moves commits from the current branch into a temporary area • Resets the current branch to the branch you are rebasing from • Applies commits from the temporary area onto the current branch • Usage • Updating a feature branch with bugfix changes • Cleaning up a local feature branch before pushing to a remote
  • 11. Remotes • Typically the main remote is named origin • origin is not a special remote • can have multiple remotes • Another Git repository used for collaboration • Changes are pushed and pulled
  • 12. A basic workflow • Create a new project • Stage files and commit • Create a remote and push • Iterative development by using branches, merging and pushing changes
  • 13. GUI Tools • Sourcetree GUI (http://www.sourcetreeapp.com/) • GitHub app • https://windows.github.com • https://mac.github.com • Others available at http://git-scm.com/download/ gui/linux
  • 14. Diff & Merge Tools • Kaleidoscope for Mac (http:// www.kaleidoscopeapp.com) • WinMerge for Windows (http://winmerge.org) • Meld for Windows (http://meldmerge.org) • Araxis Merge (http://www.araxis.com/merge)
  • 15. Resources • Pro Git Book (http://git-scm.com/book/en/v2) • GitHub (https://help.github.com) • Try Git (https://www.codeschool.com/courses/ try-git) • Git Real (https://www.codeschool.com/courses/ git-real and https://www.codeschool.com/ courses/git-real-2)