SlideShare a Scribd company logo
GIT
By:Naim Latifi
Hope you had a great summer !
Agenda
•VCS (Version control systems)
•What is GIT ?
•GIT branching
•GIT most common commands
•An example scenario
Version control systems (VCS)
• Easily management collaboration on a project by
avoiding frustration of swapping files.
• Ability to have unlimited number of developers working
on the same code base.
• Easily revert back your files if something happened.
VCS (cont’d)
• There are two main categories of version control
systems
• Centralized version control systems
• Distributed version control systems
Centralized VCS
Distributed VCS
What is GIT ?
• GIT is free and open source distributed system
with the emphasis on speed and data integrity.
• No centralized connectivity is needed.
• Powerful and cheap branching with easy to
merge.
• Loosing work in your project is very very hard.
.git directory structure
• .git
• HEAD/ (A pointer to your current branch)
• config/ ( contains all configuration preferences)
• description/(description of your project )
• Index/ (is used as staging area between working directory
and repo)
• logs/ (keeps records to changes that are made in ref)
• objects/ (all data are stored here: commits, trees and tags )
• hooks/ (shell scrips that are invoked after executing a
command)
• refs/ (holds your local branch remote branch and tags)
GIT state operation
. Working
directory
Staging area
GIT directory
(repo)
Remote repo
Untracked unmodified modified staged
Stage files
commit files
Checkout
Push
Fetch
Pull
GIT branching
• Lightweight movable pointers for different
commits.
• By default the branch name is called “master”.
• You can create as many branches as you need,
merge them or delete (branches are CHEAP on
GIT).
• Merging of branches is easy.
Branch & merge - a case scenario !
• .
fa00e49
Alice’s branches
master
test
a82bc13
79c6e38
fa00e49
fa00e49
eb97f66
fa00e44
file.x
file.x
CONFLICT
8cf9d22 M
HEAD
HEAD
HEAD
HEAD
HEAD
HEAD
GIT commits
• .
Working
directory
Staging
area
Tree object
ab3342
ab3342c
ab3354c
abffs42c
SHA-1
checksum
Blob-stores
data
tree
Commit - ad4435
tree – ab3342
author Alice
Message “test
commit”
Commit - ad5643
tree – 1csd32
parent – ad4435
author ……
……………………
Commit –
637ddx
tree – 321dzr
GIT three way merge
F44cad bb00e39
ab00e50
Master branch
Test branch
ab4532
bb00e39
Test branch
Master
bb00e39
It takes the two latest commits from branch (bb00e39, ab4532) and the most
common ancestor of the two (bb00e39) and creates a new commit (bb00e39)
after successful merge
GIT rebasing
Master branch
Test branch
Master
The major benefit of rebasing is that you get a much cleaner project history
F44cad bb00e39
ab00e50 ab4532
bb00e398
Test
F44cad bb00e39 ab00e50 ab00e51 bb00e398
Master
GIT will "undo" all commits on master that happened
after the lines began to branch out (common ancestor) and save
them temporarily
bb00e39
It then will integrate the commits
from our test branch, then the new
commits on branch master are
reapplied on top of integrated
commits from branch Test
GIT most common commands
• INIT
• CLONE
• STATUS
• ADD
• CHECKOUT
• COMMIT
• LOG
• REMOTE
• FETCH
• PUSH
• PULL
(cont’d )
creates a local repository
Checkout a repository and create a local copy of it.
(cont’d)
To see the state of your files (modified , added , remote..)
add files to your staging area
(cont’d)
Checkout a tracked file to untracked file. This command is also used for
switching between branches
Commit a stage file
(cont’d)
To get the history of your commits or commits made by someone else
Shows the remote repository name that by default is origin
(cont’d)
Updates remote repository without merging with your local
pushes your commits, branches etc. to remote repository
(cont’d)
Updates remote repository and merge changes with your local repo
An example scenario
dsfRemote repo
Origin
B
Alice
Local
repo
masterB BBoxes
PUSH
fetch
B
fetch
B
master
Boxes
Boxes
masterB
push
Local
repo
Local
repo
clone
GeorgeJohn
master
B
BBoxes
GIT presentation
QUESTIONS
Ad

More Related Content

What's hot (20)

Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
Sébastien Saunier
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
Github basics
Github basicsGithub basics
Github basics
Radoslav Georgiev
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
James Gray
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
Jeremy Coates
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
Safique Ahmed Faruque
 
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
BrianSchilder
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
Panagiotis Papadopoulos
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
Arnaud Seilles
 
Git commands
Git commandsGit commands
Git commands
Viyaan Jhiingade
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
Craig Smith
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Introducing GitLab (June 2018)
Introducing GitLab (June 2018)
Noa Harel
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version Control
Sourabh Sahu
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategies
jstack
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
Md. Ahsan Habib Nayan
 

Similar to GIT presentation (20)

Git
GitGit
Git
Mouad EL Fakir
 
GIT INTRODUCTION
GIT INTRODUCTIONGIT INTRODUCTION
GIT INTRODUCTION
MohanRaviRohitth
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
Haitham Raik
 
Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0
Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0
Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0
Embarcados
 
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
 
Training: Day Two - Eclipse, Git, Maven
Training: Day Two - Eclipse, Git, MavenTraining: Day Two - Eclipse, Git, Maven
Training: Day Two - Eclipse, Git, Maven
Artur Ventura
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
graemerocher
 
Chicago alm user group tfs version control poster - tfvc and git
Chicago alm user group   tfs version control poster - tfvc and gitChicago alm user group   tfs version control poster - tfvc and git
Chicago alm user group tfs version control poster - tfvc and git
Dave Burnison
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Brown bag sessions git workshop
Brown bag sessions git workshopBrown bag sessions git workshop
Brown bag sessions git workshop
Bishant Shrestha
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
atishgoswami
 
Git more done
Git more doneGit more done
Git more done
Kwen Peterson
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
Edureka!
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
Pranesh Vittal
 
Data science Git management
Data science Git managementData science Git management
Data science Git management
Arindam Banerjee
 
Fundamentals and basics of Git and commands
Fundamentals and basics of Git and commandsFundamentals and basics of Git and commands
Fundamentals and basics of Git and commands
DivyanshGupta922023
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
confluent
 
Version Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part IVersion Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part I
Sergey Aganezov
 
Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the stars
Strannik_2013
 
Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0
Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0
Webinar: STM32WB - microcontrolador dual-core certificado BLE 5.0
Embarcados
 
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
 
Training: Day Two - Eclipse, Git, Maven
Training: Day Two - Eclipse, Git, MavenTraining: Day Two - Eclipse, Git, Maven
Training: Day Two - Eclipse, Git, Maven
Artur Ventura
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
graemerocher
 
Chicago alm user group tfs version control poster - tfvc and git
Chicago alm user group   tfs version control poster - tfvc and gitChicago alm user group   tfs version control poster - tfvc and git
Chicago alm user group tfs version control poster - tfvc and git
Dave Burnison
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Brown bag sessions git workshop
Brown bag sessions git workshopBrown bag sessions git workshop
Brown bag sessions git workshop
Bishant Shrestha
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
atishgoswami
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
Edureka!
 
Data science Git management
Data science Git managementData science Git management
Data science Git management
Arindam Banerjee
 
Fundamentals and basics of Git and commands
Fundamentals and basics of Git and commandsFundamentals and basics of Git and commands
Fundamentals and basics of Git and commands
DivyanshGupta922023
 
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
confluent
 
Version Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part IVersion Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part I
Sergey Aganezov
 
Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the stars
Strannik_2013
 
Ad

Recently uploaded (20)

AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Ad

GIT presentation

  • 2. Hope you had a great summer !
  • 3. Agenda •VCS (Version control systems) •What is GIT ? •GIT branching •GIT most common commands •An example scenario
  • 4. Version control systems (VCS) • Easily management collaboration on a project by avoiding frustration of swapping files. • Ability to have unlimited number of developers working on the same code base. • Easily revert back your files if something happened.
  • 5. VCS (cont’d) • There are two main categories of version control systems • Centralized version control systems • Distributed version control systems
  • 8. What is GIT ? • GIT is free and open source distributed system with the emphasis on speed and data integrity. • No centralized connectivity is needed. • Powerful and cheap branching with easy to merge. • Loosing work in your project is very very hard.
  • 9. .git directory structure • .git • HEAD/ (A pointer to your current branch) • config/ ( contains all configuration preferences) • description/(description of your project ) • Index/ (is used as staging area between working directory and repo) • logs/ (keeps records to changes that are made in ref) • objects/ (all data are stored here: commits, trees and tags ) • hooks/ (shell scrips that are invoked after executing a command) • refs/ (holds your local branch remote branch and tags)
  • 10. GIT state operation . Working directory Staging area GIT directory (repo) Remote repo Untracked unmodified modified staged Stage files commit files Checkout Push Fetch Pull
  • 11. GIT branching • Lightweight movable pointers for different commits. • By default the branch name is called “master”. • You can create as many branches as you need, merge them or delete (branches are CHEAP on GIT). • Merging of branches is easy.
  • 12. Branch & merge - a case scenario ! • . fa00e49 Alice’s branches master test a82bc13 79c6e38 fa00e49 fa00e49 eb97f66 fa00e44 file.x file.x CONFLICT 8cf9d22 M HEAD HEAD HEAD HEAD HEAD HEAD
  • 13. GIT commits • . Working directory Staging area Tree object ab3342 ab3342c ab3354c abffs42c SHA-1 checksum Blob-stores data tree Commit - ad4435 tree – ab3342 author Alice Message “test commit” Commit - ad5643 tree – 1csd32 parent – ad4435 author …… …………………… Commit – 637ddx tree – 321dzr
  • 14. GIT three way merge F44cad bb00e39 ab00e50 Master branch Test branch ab4532 bb00e39 Test branch Master bb00e39 It takes the two latest commits from branch (bb00e39, ab4532) and the most common ancestor of the two (bb00e39) and creates a new commit (bb00e39) after successful merge
  • 15. GIT rebasing Master branch Test branch Master The major benefit of rebasing is that you get a much cleaner project history F44cad bb00e39 ab00e50 ab4532 bb00e398 Test F44cad bb00e39 ab00e50 ab00e51 bb00e398 Master GIT will "undo" all commits on master that happened after the lines began to branch out (common ancestor) and save them temporarily bb00e39 It then will integrate the commits from our test branch, then the new commits on branch master are reapplied on top of integrated commits from branch Test
  • 16. GIT most common commands • INIT • CLONE • STATUS • ADD • CHECKOUT • COMMIT • LOG • REMOTE • FETCH • PUSH • PULL
  • 17. (cont’d ) creates a local repository Checkout a repository and create a local copy of it.
  • 18. (cont’d) To see the state of your files (modified , added , remote..) add files to your staging area
  • 19. (cont’d) Checkout a tracked file to untracked file. This command is also used for switching between branches Commit a stage file
  • 20. (cont’d) To get the history of your commits or commits made by someone else Shows the remote repository name that by default is origin
  • 21. (cont’d) Updates remote repository without merging with your local pushes your commits, branches etc. to remote repository
  • 22. (cont’d) Updates remote repository and merge changes with your local repo
  • 23. An example scenario dsfRemote repo Origin B Alice Local repo masterB BBoxes PUSH fetch B fetch B master Boxes Boxes masterB push Local repo Local repo clone GeorgeJohn master B BBoxes

Editor's Notes

  • #13: Merge the remote branch to local master branch *(if any conflicts fix them and commit)
  • #15: As Base it takes the base commit from where the test branch is branch off (bb00e39) the last commit of test branch (ab4532) and the latest commit from branch master (bb00e39) and moves the head Master as a result of three way merge