SlideShare a Scribd company logo
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)

More Related Content

What's hot

Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
Suhas Shivaram
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
Arthur Shvetsov
 
Git ops: Git based application deployment patterns for Kubernetes
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 Muhammed
 
GitOps with Gitkube
GitOps with GitkubeGitOps with Gitkube
GitOps with Gitkube
Tirumarai Selvan
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
GDSCIIITBbsr
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Md Atique Ahmed Ziad
 
Know the Science behind WorkFlows using Git & GitHhub
Know the Science behind WorkFlows using Git & GitHhubKnow the Science behind WorkFlows using Git & GitHhub
Know the Science behind WorkFlows using Git & GitHhub
Edureka!
 
Git简介
Git简介Git简介
Git简介
clvrobj
 
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
Gorav Singal
 
Github
GithubGithub
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
GoogleDevelopersStud1
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
Emanuele Olivetti
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Bitbucket
BitbucketBitbucket
Bitbucket
Okba Mahdjoub
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma
 

What's hot (20)

Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git ops: Git based application deployment patterns for Kubernetes
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
 
GitOps with Gitkube
GitOps with GitkubeGitOps with Gitkube
GitOps with Gitkube
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Know the Science behind WorkFlows using Git & GitHhub
Know the Science behind WorkFlows using Git & GitHhubKnow the Science behind WorkFlows using Git & GitHhub
Know the Science behind WorkFlows using Git & GitHhub
 
Git简介
Git简介Git简介
Git简介
 
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
GithubGithub
Github
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 

Similar to Fundamentals of Git

Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
HubSpot
 
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
BigBlueHat
 
Git Workflow
Git WorkflowGit Workflow
Git Workflow
Gary Yeh
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
Joel W. King
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
Tim Osborn
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
Robert Lee-Cann
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
Kishor Kumar
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Nguyen Van Hung
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
git Technologies
git Technologiesgit Technologies
git Technologies
Hirantha Pradeep
 
Git and github
Git and githubGit and github
Git and github
Sayantika Banik
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Make Git Understand Excel Workbooks - Eusprig 2018
Make Git Understand Excel Workbooks - Eusprig 2018Make Git Understand Excel Workbooks - Eusprig 2018
Make Git Understand Excel Workbooks - Eusprig 2018
Björn Stiel
 
11 git version control
11 git version control11 git version control
11 git version control
Wasim Alatrash
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Sameera Wijesekara
 
ePOM - Fundamentals of Research Software Development - Code Version Control
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 Masetti
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
Haitham Raik
 
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
NCCOMMS
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
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)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Ahmed El-Arabawy
 

Similar to Fundamentals of Git (20)

Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
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 Workflow
Git WorkflowGit Workflow
Git Workflow
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
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 installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
Git and github
Git and githubGit and github
Git and github
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Make Git Understand Excel Workbooks - Eusprig 2018
Make Git Understand Excel Workbooks - Eusprig 2018Make Git Understand Excel Workbooks - Eusprig 2018
Make Git Understand Excel Workbooks - Eusprig 2018
 
11 git version control
11 git version control11 git version control
11 git version control
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
ePOM - Fundamentals of Research Software Development - Code Version Control
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
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
 
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
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
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)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
 

Recently uploaded

ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
anfaltahir1010
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
ISH Technologies
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 

Recently uploaded (20)

ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 

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)