SlideShare une entreprise Scribd logo
1  sur  50
VERSION CONTROL SYSTEMS
Saman Najafi
WHAT IS VCS?
 A TOOL
to track changes of source code
 What had changed
 When changed
 Why changed
 Who changed it
WHY USING VCS?
 Some expert’s comments:
WHY USING VCS?
 Some expert’s comments (cont.):
WHY USING VCS?
 Some expert’s comments (cont.):
“If it’s not in source control, it
doesn’t exist.”
WHY USING VCS?
 And really why?
 Prevent from accidentally deletion
 Access to the different and older
versions of your files
 Some logs maybe useful while
reviewing your project
 Managing conflicts in team works
Ayyyy…
WHY USING VCS?
 And really why? (cont.)
 Create Several versions with different functionalities
and features
 Share your code, or let other people work on your code
 Experiment with a new feature without interfering with
working code
SCENARIO I: BUG FIX
Time
1.0
First public release
of the hot new
product
Releases
SCENARIO I: BUG FIX
1.0
Releases
Internal development
continues,
progressing to version
1.3
1.3
Time
SCENARIO I: BUG FIX
1.0
Time
Releases
A fatal bug is
discovered in the
product (1.0), but 1.3
is not stable enough
to release. Solution:
Create a version
based on 1.0 with the
bug fix.
1.3
1.0 bugfix
SCENARIO I: BUG FIX
1.0
Time
Releases
The bug fix should
also be applied to the
main code line so that
the next product
release has the fix.
1.3
1.0 bugfix
1.4
SCENARIO I: BUG FIX
1.0
Time
Releases
Note that two
separate lines of
development come
back together in 1.4.
This is merging or
updating.1.3
1.0 bugfix
1.4
SCENARIO II: NORMAL DEVELOPMENT
1.5
Time
Releases
You are in the middle
of a project with
three developers
named a, b, and c.
SCENARIO II: NORMAL DEVELOPMENT
1.5
Time
Releases
The local versions
isolate the developers
from each other’s
possibly unstable
changes. Each builds
on 1.5, the most
recent stable version.
1.5a
1.5b
1.5c
SCENARIO II: NORMAL DEVELOPMENT
1.5
Time
Releases
1.5a
1.5b
1.5c
1.6
At 4:00 pm everyone
checks in their tested
modifications. A
check in is a kind of
merge where local
versions are copied
back into the version
control system.
SCENARIO II: NORMAL DEVELOPMENT
1.5
Time
Releases
1.5a
1.5b
1.5c
1.6
In many organizations
check in automatically
runs a test suite
against the result of
the check in. If the
tests fail the changes
are not accepted.
This prevents a
sloppy developer from
causing all work to
stop by, e.g., creating
a version of the
system that does not
compile.
SCENARIO III: DEBUGGING
1.5
Time
Releases
1.6
You develop a
software system
through several
revisions.
1.7
SCENARIO III: DEBUGGING
1.5
Time
Releases
1.6
In 1.7 you suddenly
discover a bug has
crept into the
system. When was it
introduced?
With version control
you can check out old
versions of the
system and see which
revision introduced
the bug.
1.7
SCENARIO IV: LIBRARIES
Time
Releases
You are building
software on top of a
third-party library,
for which you have
source.
Library A
SCENARIO IV: LIBRARIES
Time
Releases
Library A
You begin
implementation of
your software,
including
modifications to the
library.
0.7
SCENARIO IV: LIBRARIES
Time
Releases
Library A 0.7
Library B
A new version of the
library is released.
Logically this is a
branch: library
development has
proceeded
independently of your
own development.
TWO MAIN TYPES OF VCS
 Centralized version control
CENTRALIZED VERSION CONTROL
 Have a single server that contains all the versioned
files, and a number of clients that check out files
from that central place.
 For many years, this has been the standard for
version control
 Distributed version control
DISTRIBUTED VERSION CONTROL SYSTEMS
 This is where Distributed Version Control Systems
(DVCSs) step in.
 In a DVCS (such as Git, Mercurial, Bazaar or Darcs),
clients don’t just check out the latest snapshot of the
files: they fully mirror the repository.
 Thus if any server dies, and these systems were
collaborating via it, any of the client repositories can be
copied back up to the server to restore it. Every
checkout is really a full backup of all the data
 This allows you to set up several types of workflows
that aren’t possible in centralized systems, such as
hierarchical models.
KEY TERMS
 Projects : set of files in version control
 Version control doesn’t care what files
 Not a build system
 Or a test system
 Though there are often hooks to these other systems
KEY TERMS
 Repository : kind of DB stores changes on source
code during its life (such as .git directory in the git
system or .svn in the sub version)
KEY TERMS
 Working directory : local directory of files, where
you make changes
KEY TERMS
 Revision: snapshot of code at specific time
Consider
 Check out a file
 Edit it
 Check the file back in
This creates a new version of the file
 Usually increment minor version number
 E.g., 1.5 -> 1.6
KEY TERMS
 Revision (Cont.)
 For efficiency, don’t store entire new file
 Store diff with previous version
 Minimizes space
 Makes check-in, check-out potentially slower
 Must apply diffs from all previous versions to compute current
file
KEY TERMS
 With each revision, system stores
 The diffs for that version
 The new minor version number
 Other metadata
 Author
 Time of check in
 Log file message
 Head: The latest revision in current branch
KEY TERMS
 Branch: a branch is just two revisions of a file
 Two people check out 1.5
 Check in 1.5.1
 Check in 1.5.2
 Notes
 Normally checking in does not create a branch
 Changes merged into main code line
 Must explicitly ask to create a branch
KEY TERMS
Merging:
 Start with a file, say 1.5
 Bob makes changes A to 1.5
 Alice makes changes B to 1.5
 Assume Alice checks in first
 Current revision is 1.6 = apply(B,1.5)
KEY TERMS
Merging (Cont.)
 Now Bob checks in
 System notices that Bob checked out 1.5
 But current version is 1.6
 Bob has not made his changes in the current version!
 The system complains
 Bob is told to update his local copy of the code
KEY TERMS
Merging (Cont.)
 Bob does an update
 This applies Alice’s changes B to Bob’s code
 Remember Bob’s code is apply(A,1.5)
 Two possible outcomes of an update
 Success
 Conflicts
KEY TERMS
Merging (Cont.)
 Assume that
apply(A,apply(B,1.5) = apply(B,apply(A,1.5))
 Then order of changes didn’t matter
 Same result whether Bob or Alice checks in first
 The version control system is happy with this
 Bob can now check in his changes
 Because apply(B,apply(A,1.6)) = apply(B,1.6)
KEY TERMS
Merging (Cont.)
 Assume
apply(A,apply(B,1.5)  apply(B,apply(A,1.6))
 There is a conflict
 The order of the changes matters
 Version control will complain
KEY TERMS
Conflicts:
 Arise when two programmers edit the same piece
of code
 One change overwrites another
1.5: a = b;
Alice: a = b++;
Bob: a = ++b;
The system doesn’t know what should be done, and so
complains of a conflict.
KEY TERMS
Conflicts (Cont.):
 System cannot apply changes when there are
conflicts
 Final result is not unique
 Depends on order in which changes are applied
 Version control shows conflicts on update
 Generally based on diff3
 Conflicts must be resolved by hand
KEY TERMS
Conflicts (Cont.):
 Conflict detection is based on “nearness” of
changes
 Changes to the same line will conflict
 Changes to different lines will likely not conflict
 Note: Lack of conflicts does not mean Alice’s and
Bob’s changes work together
KEY TERMS
Example With No Conflict:
 Revision 1.5: int f(int a, int b) { … }
 Alice: int f(int a, int b, int c) { … }
add argument to all calls to f
 Bob: add call f(x,y)
 Merged program
 Has no conflicts
 But will not even compile
KEY TERMS
 Locking:
 Keep file in lock to prevent other users changes
1. Strict locking
2. Optimistic locking
KEY TERMS
 Pushing:
 Transfer changes of local repository to remote
repository
KEY TERMS
 Pulling:
 Get last update from remote repository to
workspace
GETTING STARTED- GIT
 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
CHECKINS OVER TIME
CHECKINS OVER TIME
Git thinks of its data more like a set of snapshots of a
mini 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 STORES DATA AS SNAPSHOTS OF THE
PROJECT OVER TIME.
GIT STRUCTURE
Version control

Contenu connexe

Tendances

Practical SVN for PHP Developers
Practical SVN for PHP DevelopersPractical SVN for PHP Developers
Practical SVN for PHP Developers
Lorna Mitchell
 
How to Design a Program Repair Bot? Insights from the Repairnator Project
How to Design a Program Repair Bot? Insights from the Repairnator ProjectHow to Design a Program Repair Bot? Insights from the Repairnator Project
How to Design a Program Repair Bot? Insights from the Repairnator Project
Simon Urli
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
Samnang Chhun
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build Technology
Philip Johnson
 

Tendances (20)

Practical SVN for PHP Developers
Practical SVN for PHP DevelopersPractical SVN for PHP Developers
Practical SVN for PHP Developers
 
Continuous Deployment
Continuous DeploymentContinuous Deployment
Continuous Deployment
 
How do you implement Continuous Delivery? Part 3: All about Pipelines
How do you implement Continuous Delivery? Part 3: All about PipelinesHow do you implement Continuous Delivery? Part 3: All about Pipelines
How do you implement Continuous Delivery? Part 3: All about Pipelines
 
How to Design a Program Repair Bot? Insights from the Repairnator Project
How to Design a Program Repair Bot? Insights from the Repairnator ProjectHow to Design a Program Repair Bot? Insights from the Repairnator Project
How to Design a Program Repair Bot? Insights from the Repairnator Project
 
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment PatternsHow do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
 
SVN Information
SVN Information  SVN Information
SVN Information
 
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
 
Enabling Agile Testing Through Continuous Integration Agile2009
Enabling Agile Testing Through Continuous Integration Agile2009Enabling Agile Testing Through Continuous Integration Agile2009
Enabling Agile Testing Through Continuous Integration Agile2009
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
Version Control
Version ControlVersion Control
Version Control
 
Microsoft SQL Server Continuous Integration
Microsoft SQL Server Continuous IntegrationMicrosoft SQL Server Continuous Integration
Microsoft SQL Server Continuous Integration
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Svn tutorial
Svn tutorialSvn tutorial
Svn tutorial
 
Version Control Training - First Lego League
Version Control Training - First Lego LeagueVersion Control Training - First Lego League
Version Control Training - First Lego League
 
Contineous integration
Contineous integrationContineous integration
Contineous integration
 
SVN Basics
SVN BasicsSVN Basics
SVN Basics
 
Continuous integration and delivery
Continuous integration and deliveryContinuous integration and delivery
Continuous integration and delivery
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build Technology
 

En vedette

Use of Emerging Technologies and transformation of teaching/learning practices
Use of Emerging Technologies and transformation of teaching/learning practicesUse of Emerging Technologies and transformation of teaching/learning practices
Use of Emerging Technologies and transformation of teaching/learning practices
Dick Ng'ambi
 
Disaster Management
Disaster ManagementDisaster Management
Disaster Management
Nc Das
 
Disaster management ppt
Disaster management pptDisaster management ppt
Disaster management ppt
Aniket Pingale
 

En vedette (16)

Introduction to Version Control Systems
Introduction to Version Control SystemsIntroduction to Version Control Systems
Introduction to Version Control Systems
 
Version Control System
Version Control SystemVersion Control System
Version Control System
 
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using KamaeliaSharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
 
Concurrent Version Systems
Concurrent Version SystemsConcurrent Version Systems
Concurrent Version Systems
 
Use of Emerging Technologies and transformation of teaching/learning practices
Use of Emerging Technologies and transformation of teaching/learning practicesUse of Emerging Technologies and transformation of teaching/learning practices
Use of Emerging Technologies and transformation of teaching/learning practices
 
Version control-systems
Version control-systemsVersion control-systems
Version control-systems
 
Practical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using KamaeliaPractical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using Kamaelia
 
Concurrent version management(tortoise CVS)
Concurrent version management(tortoise CVS)Concurrent version management(tortoise CVS)
Concurrent version management(tortoise CVS)
 
Linux13 concurrent versions system
Linux13 concurrent versions systemLinux13 concurrent versions system
Linux13 concurrent versions system
 
A brief introduction to version control systems
A brief introduction to version control systemsA brief introduction to version control systems
A brief introduction to version control systems
 
DrupalCafe5 VCS
DrupalCafe5 VCSDrupalCafe5 VCS
DrupalCafe5 VCS
 
What is version control software and why do you need it?
What is version control software and why do you need it?What is version control software and why do you need it?
What is version control software and why do you need it?
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
 
Disaster management-ppt
Disaster management-pptDisaster management-ppt
Disaster management-ppt
 
Disaster Management
Disaster ManagementDisaster Management
Disaster Management
 
Disaster management ppt
Disaster management pptDisaster management ppt
Disaster management ppt
 

Similaire à Version control

Introduction to Version Control and Configuration Management
Introduction to Version Control and Configuration ManagementIntroduction to Version Control and Configuration Management
Introduction to Version Control and Configuration Management
Philip Johnson
 
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
 

Similaire à Version control (20)

Version control
Version controlVersion control
Version control
 
Git the fast version control system
Git the fast version control systemGit the fast version control system
Git the fast version control system
 
How to use CVS applied to SOLab
How to use CVS applied to SOLabHow to use CVS applied to SOLab
How to use CVS applied to SOLab
 
Introduction to Version Control and Configuration Management
Introduction to Version Control and Configuration ManagementIntroduction to Version Control and Configuration Management
Introduction to Version Control and Configuration Management
 
Git your life for fun & profit
Git your life for fun & profitGit your life for fun & profit
Git your life for fun & profit
 
Git your life for fun & profit
Git your life for fun & profitGit your life for fun & profit
Git your life for fun & profit
 
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 ...
 
version control system (2).pptx
version control system (2).pptxversion control system (2).pptx
version control system (2).pptx
 
Software Build processes and Git
Software Build processes and GitSoftware Build processes and Git
Software Build processes and Git
 
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
5 STEPS OF CONFIGURATION MANAGEMENT FUNCTIONALITIES
5 STEPS OF CONFIGURATION MANAGEMENT FUNCTIONALITIES5 STEPS OF CONFIGURATION MANAGEMENT FUNCTIONALITIES
5 STEPS OF CONFIGURATION MANAGEMENT FUNCTIONALITIES
 
[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git
 
Subversion
SubversionSubversion
Subversion
 
Git 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizationsGit 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizations
 
Create a PHP Library the right way
Create a PHP Library the right wayCreate a PHP Library the right way
Create a PHP Library the right way
 
Bugs Found by LibreOffice in PVS-Studio
Bugs Found by LibreOffice in PVS-StudioBugs Found by LibreOffice in PVS-Studio
Bugs Found by LibreOffice in PVS-Studio
 
Continuous Everything
Continuous EverythingContinuous Everything
Continuous Everything
 
Subversion
SubversionSubversion
Subversion
 
TFS Source Control Management
TFS Source Control ManagementTFS Source Control Management
TFS Source Control Management
 

Dernier

%+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
 
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
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Dernier (20)

Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+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...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
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
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%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
 
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
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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
 
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...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%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
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

Version control

  • 2. WHAT IS VCS?  A TOOL to track changes of source code  What had changed  When changed  Why changed  Who changed it
  • 3. WHY USING VCS?  Some expert’s comments:
  • 4. WHY USING VCS?  Some expert’s comments (cont.):
  • 5. WHY USING VCS?  Some expert’s comments (cont.): “If it’s not in source control, it doesn’t exist.”
  • 6. WHY USING VCS?  And really why?  Prevent from accidentally deletion  Access to the different and older versions of your files  Some logs maybe useful while reviewing your project  Managing conflicts in team works Ayyyy…
  • 7. WHY USING VCS?  And really why? (cont.)  Create Several versions with different functionalities and features  Share your code, or let other people work on your code  Experiment with a new feature without interfering with working code
  • 8. SCENARIO I: BUG FIX Time 1.0 First public release of the hot new product Releases
  • 9. SCENARIO I: BUG FIX 1.0 Releases Internal development continues, progressing to version 1.3 1.3 Time
  • 10. SCENARIO I: BUG FIX 1.0 Time Releases A fatal bug is discovered in the product (1.0), but 1.3 is not stable enough to release. Solution: Create a version based on 1.0 with the bug fix. 1.3 1.0 bugfix
  • 11. SCENARIO I: BUG FIX 1.0 Time Releases The bug fix should also be applied to the main code line so that the next product release has the fix. 1.3 1.0 bugfix 1.4
  • 12. SCENARIO I: BUG FIX 1.0 Time Releases Note that two separate lines of development come back together in 1.4. This is merging or updating.1.3 1.0 bugfix 1.4
  • 13. SCENARIO II: NORMAL DEVELOPMENT 1.5 Time Releases You are in the middle of a project with three developers named a, b, and c.
  • 14. SCENARIO II: NORMAL DEVELOPMENT 1.5 Time Releases The local versions isolate the developers from each other’s possibly unstable changes. Each builds on 1.5, the most recent stable version. 1.5a 1.5b 1.5c
  • 15. SCENARIO II: NORMAL DEVELOPMENT 1.5 Time Releases 1.5a 1.5b 1.5c 1.6 At 4:00 pm everyone checks in their tested modifications. A check in is a kind of merge where local versions are copied back into the version control system.
  • 16. SCENARIO II: NORMAL DEVELOPMENT 1.5 Time Releases 1.5a 1.5b 1.5c 1.6 In many organizations check in automatically runs a test suite against the result of the check in. If the tests fail the changes are not accepted. This prevents a sloppy developer from causing all work to stop by, e.g., creating a version of the system that does not compile.
  • 17. SCENARIO III: DEBUGGING 1.5 Time Releases 1.6 You develop a software system through several revisions. 1.7
  • 18. SCENARIO III: DEBUGGING 1.5 Time Releases 1.6 In 1.7 you suddenly discover a bug has crept into the system. When was it introduced? With version control you can check out old versions of the system and see which revision introduced the bug. 1.7
  • 19. SCENARIO IV: LIBRARIES Time Releases You are building software on top of a third-party library, for which you have source. Library A
  • 20. SCENARIO IV: LIBRARIES Time Releases Library A You begin implementation of your software, including modifications to the library. 0.7
  • 21. SCENARIO IV: LIBRARIES Time Releases Library A 0.7 Library B A new version of the library is released. Logically this is a branch: library development has proceeded independently of your own development.
  • 22. TWO MAIN TYPES OF VCS  Centralized version control
  • 23. CENTRALIZED VERSION CONTROL  Have a single server that contains all the versioned files, and a number of clients that check out files from that central place.  For many years, this has been the standard for version control
  • 25. DISTRIBUTED VERSION CONTROL SYSTEMS  This is where Distributed Version Control Systems (DVCSs) step in.  In a DVCS (such as Git, Mercurial, Bazaar or Darcs), clients don’t just check out the latest snapshot of the files: they fully mirror the repository.  Thus if any server dies, and these systems were collaborating via it, any of the client repositories can be copied back up to the server to restore it. Every checkout is really a full backup of all the data  This allows you to set up several types of workflows that aren’t possible in centralized systems, such as hierarchical models.
  • 26. KEY TERMS  Projects : set of files in version control  Version control doesn’t care what files  Not a build system  Or a test system  Though there are often hooks to these other systems
  • 27. KEY TERMS  Repository : kind of DB stores changes on source code during its life (such as .git directory in the git system or .svn in the sub version)
  • 28. KEY TERMS  Working directory : local directory of files, where you make changes
  • 29. KEY TERMS  Revision: snapshot of code at specific time Consider  Check out a file  Edit it  Check the file back in This creates a new version of the file  Usually increment minor version number  E.g., 1.5 -> 1.6
  • 30. KEY TERMS  Revision (Cont.)  For efficiency, don’t store entire new file  Store diff with previous version  Minimizes space  Makes check-in, check-out potentially slower  Must apply diffs from all previous versions to compute current file
  • 31. KEY TERMS  With each revision, system stores  The diffs for that version  The new minor version number  Other metadata  Author  Time of check in  Log file message  Head: The latest revision in current branch
  • 32. KEY TERMS  Branch: a branch is just two revisions of a file  Two people check out 1.5  Check in 1.5.1  Check in 1.5.2  Notes  Normally checking in does not create a branch  Changes merged into main code line  Must explicitly ask to create a branch
  • 33. KEY TERMS Merging:  Start with a file, say 1.5  Bob makes changes A to 1.5  Alice makes changes B to 1.5  Assume Alice checks in first  Current revision is 1.6 = apply(B,1.5)
  • 34. KEY TERMS Merging (Cont.)  Now Bob checks in  System notices that Bob checked out 1.5  But current version is 1.6  Bob has not made his changes in the current version!  The system complains  Bob is told to update his local copy of the code
  • 35. KEY TERMS Merging (Cont.)  Bob does an update  This applies Alice’s changes B to Bob’s code  Remember Bob’s code is apply(A,1.5)  Two possible outcomes of an update  Success  Conflicts
  • 36. KEY TERMS Merging (Cont.)  Assume that apply(A,apply(B,1.5) = apply(B,apply(A,1.5))  Then order of changes didn’t matter  Same result whether Bob or Alice checks in first  The version control system is happy with this  Bob can now check in his changes  Because apply(B,apply(A,1.6)) = apply(B,1.6)
  • 37. KEY TERMS Merging (Cont.)  Assume apply(A,apply(B,1.5)  apply(B,apply(A,1.6))  There is a conflict  The order of the changes matters  Version control will complain
  • 38. KEY TERMS Conflicts:  Arise when two programmers edit the same piece of code  One change overwrites another 1.5: a = b; Alice: a = b++; Bob: a = ++b; The system doesn’t know what should be done, and so complains of a conflict.
  • 39. KEY TERMS Conflicts (Cont.):  System cannot apply changes when there are conflicts  Final result is not unique  Depends on order in which changes are applied  Version control shows conflicts on update  Generally based on diff3  Conflicts must be resolved by hand
  • 40. KEY TERMS Conflicts (Cont.):  Conflict detection is based on “nearness” of changes  Changes to the same line will conflict  Changes to different lines will likely not conflict  Note: Lack of conflicts does not mean Alice’s and Bob’s changes work together
  • 41. KEY TERMS Example With No Conflict:  Revision 1.5: int f(int a, int b) { … }  Alice: int f(int a, int b, int c) { … } add argument to all calls to f  Bob: add call f(x,y)  Merged program  Has no conflicts  But will not even compile
  • 42. KEY TERMS  Locking:  Keep file in lock to prevent other users changes 1. Strict locking 2. Optimistic locking
  • 43. KEY TERMS  Pushing:  Transfer changes of local repository to remote repository
  • 44. KEY TERMS  Pulling:  Get last update from remote repository to workspace
  • 45. GETTING STARTED- GIT  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
  • 47. CHECKINS OVER TIME Git thinks of its data more like a set of snapshots of a mini 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
  • 48. GIT STORES DATA AS SNAPSHOTS OF THE PROJECT OVER TIME.