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

Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
Jiwon Baek
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
Thomas Rausch
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
GoogleDevelopersStud1
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
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
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
Mack Hardy
 
Git
GitGit
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
Noa Harel
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
Md Swawibe Ul Alam
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
Aderemi Dadepo
 
Source control
Source controlSource control
Source control
Sachithra Gayan
 
Git101
Git101Git101
Git101
Jason Noble
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
Krunal Doshi
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
Anwarul Islam
 

What's hot (20)

Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
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 workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Git
GitGit
Git
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Source control
Source controlSource control
Source control
 
Git101
Git101Git101
Git101
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 

Similar to Git

GIT INTRODUCTION
GIT INTRODUCTIONGIT INTRODUCTION
GIT INTRODUCTION
MohanRaviRohitth
 
Git and GitHub (1).pptx
Git and GitHub (1).pptxGit and GitHub (1).pptx
Git and GitHub (1).pptx
BetelAddisu
 
Source Control Using Git
Source Control Using Git Source Control Using Git
Source Control Using Git
Chris Mylonas
 
Git
GitGit
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
gdsc13
 
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 Git
atishgoswami
 
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
Ashoka R K T
 
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.pptx
GIT.pptxGIT.pptx
GIT.pptx
Soumen Debgupta
 
Git
GitGit
Git 101
Git 101Git 101
Git 101
jayrparro
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With SubversionSamnang Chhun
 
Git theory
Git   theoryGit   theory
Git theory
hariprasad1035
 
Git and Github
Git and GithubGit and Github
Git and Github
Akshay Vasava
 
Gitgithub101slideshare 150922131830-lva1-app6891
Gitgithub101slideshare 150922131830-lva1-app6891Gitgithub101slideshare 150922131830-lva1-app6891
Gitgithub101slideshare 150922131830-lva1-app6891
Brian 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-lesson
Yoram 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
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
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

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 

Recently uploaded (20)

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 

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>