SlideShare a Scribd company logo
1 of 18
VERSION CONTROL
AND GIT
Sreedevi Vedula
Terms used
• VCS – Version Control System
• Check-in – Storing files in the VCS Central Repo
• Check-out – Getting files from the VCS Central Repo
• Commit – Git’s term for check-in
What does version control do?
• Version files
• Manage changes from multiple users
• Store the versions in a central repository
Version Files
Version 1
Version 2
Version 1
Multi-User Check-in
Subsequent
Check-in at
9 A.M
Checkout
at 8 A.M.
Checkout
at 10
A.M.
Check-in
at 11 A.M.
VCS: “I
am
good”
Multi-User Check-in
Concurrent - Different Files
Check-in
at 9 A.M.
Check-out
at 8 A.M.
Check-out
at 8 A.M.
VCS: “I
am
good”
Check-in
at 9 A.M.
Multi-User Check-in
Concurrent – Same Files
Check-in at
9 A.M.
Check-out
at 8 A.M.
Modified lines:
Line 5
Line 6
Holiday.py
Modified lines:
Line 10
Line 11
Holiday.py
Merge
Check-in
at 10 A.M.
Check-out
at 8:30 A.M.
Multi-User Check-in
Concurrent – Same Files
9 A.M.
Merge
Conflict
Line 5
Line 6
Holiday.py
Line 5
Line 6
Holiday.py
10 A.M.
Check-out
at 8 A.M.
Check-out
at 8 A.M.
Take Snapshots of Repos
Release 1.0 Release 2.0
Create branches
Release 1.0
E-Fixes
Version 12 Version 13
Version 1 Version 2
Merge branches
Release 1.0
E-Fixes
Version 12 Version 13 Version 14
Release 2.0
Git – How is it different
• Repository is seen as a whole and not as files
• Commit a repo and not files
• Go back to a specific version of a repo and not a file
• Repository is local and not remote
• Entire repository can be accessed locally
• No need to be connected to the remote server
• Branches are also versions of the repo and not copies of it
• Create a new branches in the same filesystem
• Pull branches from remote server into the same filesystem
• Work on two branches simultaneously in the same file system
• Forking user repo is inherent
• Github server provides you option to fork your copy of the repo which
helps collaboration initiated from the user side
• Free github account to host experimental projects
Git Repository
• git init
• Creates a git local repository
• .git directory
• A hidden directory in the repository which has the repo information
like version history of all the files, branch information
• git clone <url>
• Download the remote repository at <url> and create a local
repository for it
Git – Working with files
• The four states for a file
• Untracked – The files that are not never added to git are in this stage
• Unmodified – Files that are in the git repo, but not edited.
• Modified – Files edited by you after getting changes from the repo
• Staged –Files that are staged for commit
• git add
• Moves untracked files / modified files to staged state
• git rm
• Move staged files to modified / untracked files
• git diff
• Show changes made to files in modified state
• git diff –cached
• Show changes made to files in staged state
• git commit
• Save changes to the local repository
• git checkout – <file>
• discard changes in working directory
• git reset
• Reset or revert to an earlier commit
• git log
• Show the commit history of the
Git – Working with branches
• git checkout –b
• Create a new branch and switch to it
• git branch
• List all the branches
• git merge <branch>
• Merge the current branch with the changes from <branch>
• git rebase <branch>
• Modify the development history of the current branch by pulling the
commits from it since the common latest commit <A> of the two
branches, apply the commit history of <branch> since <A> to the
latest commit to the current branch and re-apply the pulled-out
commits on top of it.
Git – Connecting with remotes
• User configuration
• Repo Level - .git/config
• Global Level - ~/.gitconfig
• System Level - /etc/gitconfig
• Know your git configuration
• git config
Git – working with remotes
• The three transfer protocols that help upload / download content from the remote
repositories
• Git
• Fastest Transfer
• No authentication
• SSH
• Authenticated Write access
• Efficient data transfer
• Encrypted data transfer
• Http
• Easy to setup
• Can serve read-only repos
• Corporate firewalls usually allow HTTP traffic
• Slow data transfer
• git clone <url>
• Creates a local repository for a remote repo given by <url>
• git remote add <remote-name> <url>
• Add a git remote specified by <remote-name> for the repo at <url>
• git pull <remote-name> <branch>
• Pull changes from the branch <branch> of remote repo mapped to <remote-name>
• git push <remote-name> <branch>
• Push changes to the branch <branch> of remote repo mapped to <remote-name>
References
• http://git-scm.com/book

More Related Content

What's hot

Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version ControlSourabh Sahu
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHubJames Gray
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagramsDilum Navanjana
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
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
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Simplilearn
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHubVikram SV
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 

What's hot (20)

Introduction git
Introduction gitIntroduction git
Introduction git
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version Control
 
Github
GithubGithub
Github
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
git and github
git and githubgit and github
git and github
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
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
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Github basics
Github basicsGithub basics
Github basics
 
Git commands
Git commandsGit commands
Git commands
 
Git and github
Git and githubGit and github
Git and github
 

Similar to Git

Git and GitHub (1).pptx
Git and GitHub (1).pptxGit and GitHub (1).pptx
Git and GitHub (1).pptxBetelAddisu
 
Source Control Using Git
Source Control Using Git Source Control Using Git
Source Control Using Git Chris Mylonas
 
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
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
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
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Gitatishgoswami
 
Quick and easy way to get started with Git & GitHub
Quick and easy way to get started with Git & GitHubQuick and easy way to get started with Git & GitHub
Quick and easy way to get started with Git & GitHubAshoka R K T
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With SubversionSamnang Chhun
 
Gitgithub101slideshare 150922131830-lva1-app6891
Gitgithub101slideshare 150922131830-lva1-app6891Gitgithub101slideshare 150922131830-lva1-app6891
Gitgithub101slideshare 150922131830-lva1-app6891Brian Okinyi
 
Source-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lessonSource-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lessonYoram Michaeli
 

Similar to Git (20)

GIT INTRODUCTION
GIT INTRODUCTIONGIT INTRODUCTION
GIT INTRODUCTION
 
Git and GitHub (1).pptx
Git and GitHub (1).pptxGit and GitHub (1).pptx
Git and GitHub (1).pptx
 
Source Control Using Git
Source Control Using Git Source Control Using Git
Source Control Using Git
 
Git
GitGit
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
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
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)
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Quick and easy way to get started with Git & GitHub
Quick and easy way to get started with Git & GitHubQuick and easy way to get started with Git & GitHub
Quick and easy way to get started with Git & GitHub
 
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.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 
Git
GitGit
Git
 
Git 101
Git 101Git 101
Git 101
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
 
Git theory
Git   theoryGit   theory
Git theory
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Gitgithub101slideshare 150922131830-lva1-app6891
Gitgithub101slideshare 150922131830-lva1-app6891Gitgithub101slideshare 150922131830-lva1-app6891
Gitgithub101slideshare 150922131830-lva1-app6891
 
Source-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lessonSource-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lesson
 

Recently uploaded

%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 

Recently uploaded (20)

%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

Git

  • 2. Terms used • VCS – Version Control System • Check-in – Storing files in the VCS Central Repo • Check-out – Getting files from the VCS Central Repo • Commit – Git’s term for check-in
  • 3. What does version control do? • Version files • Manage changes from multiple users • Store the versions in a central repository
  • 5. Multi-User Check-in Subsequent Check-in at 9 A.M Checkout at 8 A.M. Checkout at 10 A.M. Check-in at 11 A.M. VCS: “I am good”
  • 6. Multi-User Check-in Concurrent - Different Files Check-in at 9 A.M. Check-out at 8 A.M. Check-out at 8 A.M. VCS: “I am good” Check-in at 9 A.M.
  • 7. Multi-User Check-in Concurrent – Same Files Check-in at 9 A.M. Check-out at 8 A.M. Modified lines: Line 5 Line 6 Holiday.py Modified lines: Line 10 Line 11 Holiday.py Merge Check-in at 10 A.M. Check-out at 8:30 A.M.
  • 8. Multi-User Check-in Concurrent – Same Files 9 A.M. Merge Conflict Line 5 Line 6 Holiday.py Line 5 Line 6 Holiday.py 10 A.M. Check-out at 8 A.M. Check-out at 8 A.M.
  • 9. Take Snapshots of Repos Release 1.0 Release 2.0
  • 10. Create branches Release 1.0 E-Fixes Version 12 Version 13 Version 1 Version 2
  • 11. Merge branches Release 1.0 E-Fixes Version 12 Version 13 Version 14 Release 2.0
  • 12. Git – How is it different • Repository is seen as a whole and not as files • Commit a repo and not files • Go back to a specific version of a repo and not a file • Repository is local and not remote • Entire repository can be accessed locally • No need to be connected to the remote server • Branches are also versions of the repo and not copies of it • Create a new branches in the same filesystem • Pull branches from remote server into the same filesystem • Work on two branches simultaneously in the same file system • Forking user repo is inherent • Github server provides you option to fork your copy of the repo which helps collaboration initiated from the user side • Free github account to host experimental projects
  • 13. Git Repository • git init • Creates a git local repository • .git directory • A hidden directory in the repository which has the repo information like version history of all the files, branch information • git clone <url> • Download the remote repository at <url> and create a local repository for it
  • 14. Git – Working with files • The four states for a file • Untracked – The files that are not never added to git are in this stage • Unmodified – Files that are in the git repo, but not edited. • Modified – Files edited by you after getting changes from the repo • Staged –Files that are staged for commit • git add • Moves untracked files / modified files to staged state • git rm • Move staged files to modified / untracked files • git diff • Show changes made to files in modified state • git diff –cached • Show changes made to files in staged state • git commit • Save changes to the local repository • git checkout – <file> • discard changes in working directory • git reset • Reset or revert to an earlier commit • git log • Show the commit history of the
  • 15. Git – Working with branches • git checkout –b • Create a new branch and switch to it • git branch • List all the branches • git merge <branch> • Merge the current branch with the changes from <branch> • git rebase <branch> • Modify the development history of the current branch by pulling the commits from it since the common latest commit <A> of the two branches, apply the commit history of <branch> since <A> to the latest commit to the current branch and re-apply the pulled-out commits on top of it.
  • 16. Git – Connecting with remotes • User configuration • Repo Level - .git/config • Global Level - ~/.gitconfig • System Level - /etc/gitconfig • Know your git configuration • git config
  • 17. Git – working with remotes • The three transfer protocols that help upload / download content from the remote repositories • Git • Fastest Transfer • No authentication • SSH • Authenticated Write access • Efficient data transfer • Encrypted data transfer • Http • Easy to setup • Can serve read-only repos • Corporate firewalls usually allow HTTP traffic • Slow data transfer • git clone <url> • Creates a local repository for a remote repo given by <url> • git remote add <remote-name> <url> • Add a git remote specified by <remote-name> for the repo at <url> • git pull <remote-name> <branch> • Pull changes from the branch <branch> of remote repo mapped to <remote-name> • git push <remote-name> <branch> • Push changes to the branch <branch> of remote repo mapped to <remote-name>