SlideShare a Scribd company logo
1 of 22
Content
 Version control
 Advantages & disadvantages of GIT
 GIT basics
2
Version Control
 Version control (or revision control, or source control) is all
about managing multiple versions of documents,
programs, web sites, etc.
 Some well-known version control systems are CVS, Subversion,
Mercurial, and Git.
 Distributed systems like Mercurial and Git are newer and are
gradually replacing centralized systems like
CVS and Subversion.
3
Local Version Control
 Local version-control method of choice is to copy files into
another directory(perhaps a time-stamped directory, if they’re
clever).
 This approach is very common because it is so simple, but
it is also incredibly error prone.
 Ex :-
• RCS
4
Local Version Control5
Centralized Version Control
 Traditional version control system.
• Server with database
• Clients have a working version
 Challenges
• Multi-developer conflicts
• Client/server communication
 Ex :-
• CVS
• Subversion
• Visual source safe
6
Centralized Version Control
7
Distributed Version Control
 Authoritative server by convention only.
 Every working checkout is a repository.
 Get version control even when detached.
 Backups are trivial.
 Ex :-
• Mercurial
• BitKeeper
• Darcs
• Bazaar
8
Distributed Version Control
9
Advantages of GIT
 Resilience
• No one repository has more data than any other
 Speed
• Very fast operations compared to other VCS (I’m looking at
you CVS and Subversion)
 Space
• Compression can be done across repository not just per file
• Minimizes local size as well as push/pull data transfers
 Simplicity
• Object model is very simple
 Large user base with robust tools
10
Disadvantages of GIT
 Definite learning curve, especially for those used to centralized
systems.
• Can sometimes seem overwhelming to learn
 Conceptual difference
 Huge amount of commends
11
GIT Basics
 Storing data as changes to a base version of
each file.
12
 Storing data as snapshots of the project over time.
13
 Working directory, staging area, and Git directory.
14
Introduce yourself to GIT
 Enter these lines (with appropriate changes):
• git config --global user.name "John Smith"
• git config --global user.email
jsmith@seas.upenn.edu
 You only need to do this once.
 If you want to use a different name/email address for a particular
project, you can change it for just that project.
• cd to the project directory.
• Use the above commands, but leave out the --global
15
Create and fill a repository
 cd to the project directory you want to use.
 Type in git init
• This creates the repository (a directory named .git).
• You seldom (if ever) need to look inside this directory.
 Type in git add
• The period at the end is part of this command!
• Period means “this directory”.
• This adds all your current files to the repository.
 Type in git commit –m "Initial commit“
• You can use a different commit message, if you like.
16
Clone a repository from elsewhere
 git clone URL
 git clone URL mypath
• These make an exact copy of the repository at the given URL.
 git clone git://github.com/rest_of_path/file.git
• Github is the most popular (free) public repository.
 All repositories are equal,
• But you can treat some particular repository (such as one on
Github) as the “master” directory.
 Typically, each team member works in his/her own repository,
and “merges” with other repositories as appropriate.
17
Making commits
 If you create new files and/or folders, they are not tracked by Git
unless you ask it to do so.
• git add newFile1 newFolder1 newFolder2 newFile2
 Committing makes a “snapshot” of everything being tracked into
your repository.
• A message telling what you have done is required
• git commit –m “Uncrevulated the conundrum bar”
• git commit
 This version opens an editor for you the enter the message.
 To finish, save and quit the editor.
 Format of the commit message.
• One line containing the complete summary.
• If more than one line, the second line must be blank.
18
Choose an editor
When you “commit,” git will require you to type in a commit
message.
For longer commit messages, you will use an editor.
The default editor is probably vim .
To change the default editor:
• git config --global core.editor /path/to/editor
You may also want to turn on colors:
• git config --global color.ui auto
19
Typical workflow
 git pull remote_repository
• Get changes from a remote repository and merge them into
your own repository.
 git status
• See what Git thinks is going on.
• Use this frequently!
 Work on your files (remember to add any new ones).
 git commit –m “What I did”
 git push
20
Multiple versions
Initial commit
Second commit
Third commit
Bob gets a copy
Fourth commit
Merge
Bob’s commit
21
Source control

More Related Content

What's hot

GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Indonesia
 
What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020Noa Harel
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash CourseNilay Binjola
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIDavid Hahn
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab IntroductionKrunal Doshi
 
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 SessionAnwarul Islam
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD processHYS Enterprise
 
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
 
Learning git
Learning gitLearning git
Learning gitSid Anand
 
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 GithubHouari ZEGAI
 

What's hot (20)

GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
 
What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab 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
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD process
 
Jenkins
JenkinsJenkins
Jenkins
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git
GitGit
Git
 
Gitlab CI/CD
Gitlab CI/CDGitlab CI/CD
Gitlab CI/CD
 
Git
GitGit
Git
 
BitBucket presentation
BitBucket presentationBitBucket presentation
BitBucket presentation
 
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 and Github
Git and GithubGit and Github
Git and Github
 
Learning git
Learning gitLearning git
Learning git
 
Introduction to git & GitHub
Introduction to git & GitHubIntroduction to git & GitHub
Introduction to git & GitHub
 
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 & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 

Similar to Source control

Similar to Source control (20)

Source control
Source controlSource control
Source control
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
git.ppt
git.pptgit.ppt
git.ppt
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Git
GitGit
Git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git
GitGit
Git
 
Basics of git
Basics of gitBasics of git
Basics of git
 
Git hub
Git hubGit hub
Git hub
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Git
GitGit
Git
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git for developers
Git for developersGit for developers
Git for developers
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 

More from Sachithra Gayan

Computer Network Security
Computer Network SecurityComputer Network Security
Computer Network SecuritySachithra Gayan
 
Best Practices in Project Management
Best Practices in Project ManagementBest Practices in Project Management
Best Practices in Project ManagementSachithra Gayan
 
Data acquisition softwares
Data acquisition softwaresData acquisition softwares
Data acquisition softwaresSachithra Gayan
 
Software Quality Assurance
Software Quality AssuranceSoftware Quality Assurance
Software Quality AssuranceSachithra Gayan
 

More from Sachithra Gayan (6)

Computer Network Security
Computer Network SecurityComputer Network Security
Computer Network Security
 
Embedded Robotics
Embedded RoboticsEmbedded Robotics
Embedded Robotics
 
Best Practices in Project Management
Best Practices in Project ManagementBest Practices in Project Management
Best Practices in Project Management
 
Data acquisition softwares
Data acquisition softwaresData acquisition softwares
Data acquisition softwares
 
Software Quality Assurance
Software Quality AssuranceSoftware Quality Assurance
Software Quality Assurance
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

Recently uploaded

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
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
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
 
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
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
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
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%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
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
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
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Recently uploaded (20)

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
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
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?
 
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 🔝✔️✔️
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
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
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton 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
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
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...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

Source control

  • 1.
  • 2. Content  Version control  Advantages & disadvantages of GIT  GIT basics 2
  • 3. Version Control  Version control (or revision control, or source control) is all about managing multiple versions of documents, programs, web sites, etc.  Some well-known version control systems are CVS, Subversion, Mercurial, and Git.  Distributed systems like Mercurial and Git are newer and are gradually replacing centralized systems like CVS and Subversion. 3
  • 4. Local Version Control  Local version-control method of choice is to copy files into another directory(perhaps a time-stamped directory, if they’re clever).  This approach is very common because it is so simple, but it is also incredibly error prone.  Ex :- • RCS 4
  • 6. Centralized Version Control  Traditional version control system. • Server with database • Clients have a working version  Challenges • Multi-developer conflicts • Client/server communication  Ex :- • CVS • Subversion • Visual source safe 6
  • 8. Distributed Version Control  Authoritative server by convention only.  Every working checkout is a repository.  Get version control even when detached.  Backups are trivial.  Ex :- • Mercurial • BitKeeper • Darcs • Bazaar 8
  • 10. Advantages of GIT  Resilience • No one repository has more data than any other  Speed • Very fast operations compared to other VCS (I’m looking at you CVS and Subversion)  Space • Compression can be done across repository not just per file • Minimizes local size as well as push/pull data transfers  Simplicity • Object model is very simple  Large user base with robust tools 10
  • 11. Disadvantages of GIT  Definite learning curve, especially for those used to centralized systems. • Can sometimes seem overwhelming to learn  Conceptual difference  Huge amount of commends 11
  • 12. GIT Basics  Storing data as changes to a base version of each file. 12
  • 13.  Storing data as snapshots of the project over time. 13
  • 14.  Working directory, staging area, and Git directory. 14
  • 15. Introduce yourself to GIT  Enter these lines (with appropriate changes): • git config --global user.name "John Smith" • git config --global user.email jsmith@seas.upenn.edu  You only need to do this once.  If you want to use a different name/email address for a particular project, you can change it for just that project. • cd to the project directory. • Use the above commands, but leave out the --global 15
  • 16. Create and fill a repository  cd to the project directory you want to use.  Type in git init • This creates the repository (a directory named .git). • You seldom (if ever) need to look inside this directory.  Type in git add • The period at the end is part of this command! • Period means “this directory”. • This adds all your current files to the repository.  Type in git commit –m "Initial commit“ • You can use a different commit message, if you like. 16
  • 17. Clone a repository from elsewhere  git clone URL  git clone URL mypath • These make an exact copy of the repository at the given URL.  git clone git://github.com/rest_of_path/file.git • Github is the most popular (free) public repository.  All repositories are equal, • But you can treat some particular repository (such as one on Github) as the “master” directory.  Typically, each team member works in his/her own repository, and “merges” with other repositories as appropriate. 17
  • 18. Making commits  If you create new files and/or folders, they are not tracked by Git unless you ask it to do so. • git add newFile1 newFolder1 newFolder2 newFile2  Committing makes a “snapshot” of everything being tracked into your repository. • A message telling what you have done is required • git commit –m “Uncrevulated the conundrum bar” • git commit  This version opens an editor for you the enter the message.  To finish, save and quit the editor.  Format of the commit message. • One line containing the complete summary. • If more than one line, the second line must be blank. 18
  • 19. Choose an editor When you “commit,” git will require you to type in a commit message. For longer commit messages, you will use an editor. The default editor is probably vim . To change the default editor: • git config --global core.editor /path/to/editor You may also want to turn on colors: • git config --global color.ui auto 19
  • 20. Typical workflow  git pull remote_repository • Get changes from a remote repository and merge them into your own repository.  git status • See what Git thinks is going on. • Use this frequently!  Work on your files (remember to add any new ones).  git commit –m “What I did”  git push 20
  • 21. Multiple versions Initial commit Second commit Third commit Bob gets a copy Fourth commit Merge Bob’s commit 21

Editor's Notes

  1. What is “version control”, and why should you care? Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
  2. It is easy to forget which directory you’re in and accidentally write to the wrong file or copy over files you don’t mean to. To deal with this issue, programmers long ago developed local VCSs that had a simple database that kept all the changes to files under revision control.
  3. A distributed version control system
  4. The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data. Conceptually, most other systems store information as a list of file-based changes. These systems (CVS, Subversion, Perforce, Bazaar, and so on) think of the information they keep as a set of files and the changes made to each file over time.
  5. Git doesn’t think of or store its data this way. Instead, Git thinks of its data more like a set of snapshots of a miniature filesystem. Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot. To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored. Git thinks about its data more like a stream of snapshots.
  6. 1. You modify files in your working directory. 2. You stage the files, adding snapshots of them to your staging area. 3. You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
  7. Git echo ‘my project’ > sac
  8. Your top-level working directory contains everything about your project The working directory probably contains many subdirectories—source code, binaries, documentation, data files, etc. One of these subdirectories, named .git, is your repository At any time, you can take a “snapshot” of everything (or selected things) in your project directory, and put it in your repository When you said git init in your project directory, or when you cloned an existing project, you created a repository The repository is a subdirectory named .git containing various files The dot indicates a “hidden” directory You do not work directly with the contents of that directory; various git commands do that for you You do need a basic understanding of what is in the repository
  9. A commit is when you tell git that a change (or addition) you have made is ready to be included in the project