SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Introduction to Version Control
SE-2030
Dr. Mark L. Hornick
1
Based on material at http://svnbook.red-bean.com/
and git-scm.com/book
2
The stages of developing a
software application
 Requirements Analysis
 High-level Design
 [Plan (SE2800)]
 Low-level Design
 Implementation
 Unit Test (SE2832)
 Integration
 System Test (SE3800)
 Deploy (SDL)
 Maintain (SDL)
In many cases, multiple projects
run concurrently
New features are typically
being added to the next
version
While at the same time,
defects need to be
corrected in existing
releases
You will do this more in SDL
SE-2030
Dr. Mark L. Hornick
3
On a single project, a team of
software engineers work together
toward a release
All team members work on the
same code and develop their
respective parts
An engineer may be
responsible for an entire class
Or just a few methods within a
particular class
SE-2030
Dr. Mark L. Hornick
4
Files have to be shared among
developers on a team project
Shared files can be kept in
some type of Repository
where they can be
accessed and worked on by
multiple individuals
SE-2030
Dr. Mark L. Hornick
5
Image: http://svnbook.red-bean.com/
Harry and Sally get their own respective
local Working Copies of the Master File in
the Repository
What might you use for a
Repository?
Would any of these work?
 USB/SD drive
 Private network drive
 E.g. shared “X:” drive
 Cloud drive
 Google drive
 Dropbox
 iCloud
SE-2030
Dr. Mark L. Hornick
6
Image: http://svnbook.red-bean.com/
Sharing files can lead to big
problems…
SE-2030
Dr. Mark L. Hornick
7
Image: http://svnbook.red-bean.com/
Adds some method Modifies some other method
The problem to avoid:
SE-2030
Dr. Mark L. Hornick
Image: http://svnbook.red-bean.com/
Harry’s changes are still held locally…
Harry’s changes are lost
SE-2030
Dr. Mark L. Hornick
Image: http://svnbook.red-bean.com/
‘’
‘’
Harry’s local file gets overwritten with
Sally’s latest changes.
The Issue: Effective management of
software artifacts, especially code
Some acronyms:
 SCM – Source Code Management
 SCCM – Source Code Configuration
Management
 RCS – Revision Control System
 VCS – Version Control System
 DVCS - Distributed Version Control Systems
SE-2030
Dr. Mark L. Hornick
10
Revision/Version History might help
 …but USB/SD, private network drives do not
maintain revision history
 Cloud drives (e.g. Google Drive, Dropbox,
iCould/Time Machine) maintain a (limited)
history of the various revisions of a file
 Google Drive: keeps last 100 revisions or last 30
days
 Supported in “Classic” mode only – going
away?
 IF you detect a collision, you can manually
merge the differences and resynchronize your
work
 Might be workable for two people – what about 5
or 10?
SE-2030
Dr. Mark L. Hornick
11
Any other disadvantages to
Google Drive/Dropbox/iCloud
 Security?
 Support (bug fixes and new features)?
 Ownership of stored information?
 Cost?
 Ease of Use?
 Acceptance?
SE-2030
Dr. Mark L. Hornick
12
Special-purpose Revision Control
Systems have been around a lot
longer than Google Drive or Dropbox
 SCCS, 1972 (IBM)
 RCS, 1982 (Unix)
 SourceSafe 1995 (Microsoft)
 CVS, 1986 (multi-platform)
 SVN, 2000 (multi-platform)
 Git and Mercurial, 2005 (multi-platform)
The way these work has evolved over the
years
SE-2030
Dr. Mark L. Hornick
13
Features of version control
systems
 All changes to a file are tracked
 Version histories show who, what, when
 Changes can be reverted (rewound to any
earlier version)
 Changes between revisions are easy to
identify
SE-2030
Dr. Mark L. Hornick
14
The Lock-Modify-Unlock
solution
SE-2030
Dr. Mark L. Hornick
Image: http://svnbook.red-bean.com/
Sally must wait until Harry releases the lock,
although she can retrieve a “readonly”
version of the file in the meantime.
Early systems followed this model
(RCS, SourceSafe)
Lock-Modify-Unlock only allows a
single user to edit the file at a time
SE-2030
Dr. Mark L. Hornick
Image: http://svnbook.red-bean.com/
Sally must continually poll the system to
see if the file has been unlocked, or Harry
needs to tell her when he unlocks it.
Lock-Modify-Unlock has
certain drawbacks:
Harry has to remember to release his lock
before Sally (or anyone else) can acquire the
lock in order to edit
Sally has to wait for Harry to finish before
editing (editing must be done sequentially)
 Harry might be adding some new methods (takes
a long time)
 Harry might forget to release the lock before going
home (or on vacation!)
SE-2030
Dr. Mark L. Hornick
17
The Copy-Modify-Merge solution
allows concurrent editing
SE-2030
Dr. Mark L. Hornick
18
Image: http://svnbook.red-bean.com/
Harry adds
new methods
Sally adds
comments
CVS, SVN use this model
The Repository recognizes
conflicts
SE-2030
Dr. Mark L. Hornick
19
Image: http://svnbook.red-bean.com/
Harry is prevented from writing
Conflicting versions of the files are
merged
SE-2030
Dr. Mark L. Hornick
20
Image: http://svnbook.red-bean.com/
Conflicts are automatically
resolved in many cases using
robust merging algorithms.
However, manual merging is
sometimes necessary and can
introduce errors.
The Repository keeps both
users synchronized
SE-2030
Dr. Mark L. Hornick
21
Image: http://svnbook.red-bean.com/
Copy-Modify-Merge is generally
easy to use and manage
Users can work in parallel
Most of the time, concurrent changes
don’t overlap
 People generally don’t edit exactly the
same code simultaneously, so merging is
done automatically in many cases
 Amount of time spent resolving conflicts is
nearly always less than the time that would
be spent waiting for a lock to be released
SE-2030
Dr. Mark L. Hornick
22
Is Lock-Modify-Unlock ever
needed anymore?
When two or more people need to
work on the same file, the
simultaneous changes may not
be mergable in all cases:
 MS Office documents
 Image documents
 Other binary files
SE-2030
Dr. Mark L. Hornick
23
Subversion is an open-source version
control system that is available and
still supported for many platforms
 Windows
 Mac
 Linux
Many current open-source projects use
Subversion to maintain source code control
 http://subversion.tigris.org/
 Latest release 8/2014
 MSOE still maintains Subversion on a linux server
SE-2030
Dr. Mark L. Hornick
24
Subversion’s main drawback is the
centralized nature of the Repository
A repository is typically hosted
on a server.
 Version history is on the
server, not on your local PC
 If the server or network
become unavailable,
everyone gets stuck with the
working copy they have.
SE-2030
Dr. Mark L. Hornick
25
Image: http://svnbook.red-bean.com/
Distributed Version Control
SE-2030
Dr. Mark L. Hornick
26
Image: http://git-scm.com/book/
A “remote master” repository is
typically hosted on a server.
 Clones of the remote repository are
maintained on each user’s
computer
 If the server goes down, users can
continue sharing code (provided
they can connect over a network)
by synch’ing to each others’
repositories
 If the network is unavailable, users
can continue reading & writing to
their own local repository –
synch’ing with others later Git and Mercurial use this
model
Merging in a DVCS, part 1
SE-2030
Dr. Mark L. Hornick
27
1. Initially, both users’ repositories
are synch’d to the remote master;
All files are identical.
2. Both users edit the same file, and their
local repositories reflect their changes
Merging in a DVCS, part 2
SE-2030
Dr. Mark L. Hornick
28
3. User A “pushes” her repository
to the remote master to synch; this
succeeds.
4. User B attempts to “push” his repository
to the remote to synch; this fails due to
User A’s earlier push. Remote does
not change.
Merging in a DVCS, part 3
SE-2030
Dr. Mark L. Hornick
29
5. User B “pulls” User A’s updates
from the remote master, merging
A and B together. Merging is
automatic with some exceptions.
6. User B “pushes” his repository
to the remote to synch; this now succeeds
Merging in a DVCS, part 4
SE-2030
Dr. Mark L. Hornick
30
7. User B “pulls” from the remote, and everyone is in synch again.
Repositories can also manage and
track differences between parallel
revisions of a document
 Typically, a software product will undergo
parallel development on different branches (e.g.
for new/future features) while primary
development takes place on some main branch
SE-2030
Dr. Mark L. Hornick
31
Image: http://svnbook.red-bean.com/
The master branch should only be used for
maintaining production-ready code (and
related files)
 Code modified or created during a development cycle should be
maintained on separate branches
 A second standard branch – often named “dev” is typically used to
maintain code that is being actively worked on
 At the beginning of a cycle, the dev branch is identical to master
 During development, the dev branch maintains the evolving code
 At the end of a cycle, the dev branch contains the completed code.
 The dev branch is then merged into the master branch, and the process
repeats with the next cycle (more on this later).
SE-2800
Dr. Mark L. Hornick
32
master
merge
branch merge
Version 1 Version 2 Version 3
dev
There are two ways to create
another branch
1. For example, create a local dev branch and then
push that branch to the remote
2. Create a remote dev branch (using the Bitbucket
web interface), and then fetch that branch locally
 <<Demo of remote branch creation>>
SE-2800
Dr. Mark L. Hornick
33
$ git branch dev
$ << Note:the command executes silently>>
$ git fetch && git checkout dev
From bitbucket.org:se2800/MyRepository
* [new branch] dev -> origin/dev
Branch dev set up to track remote branch dev from origin.
Switched to a new branch dev'
Git commands for branch
status
 Use git branch to see what local branch you are
currently working on:
SE-2800
Dr. Mark L. Hornick
34
$ git branch
* dev
master
 Use git fetch && git branch -r to list all remote
branches:
$ git fetch
$ git branch -r
origin/master
origin/dev
Git commands for switching
branches
 Use git checkout master to switch your working
directory to the master branch:
SE-2800
Dr. Mark L. Hornick
35
$ git checkout master
dev
* master
 Use git checkout dev to switch your working
directory to the dev branch:
$ git checkout dev
* dev
master
NOTE: If you currently have nothing to commit, and you switch
branches, the code in your working directory will be replaced with the
code that is in the branch you’re switching to.

Weitere ähnliche Inhalte

Ähnlich wie se2030-11 Intro to version control(1).ppt

Module 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoingModule 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoingalhassanjawad1
 
CI/CD Pipeline with Docker
CI/CD Pipeline with DockerCI/CD Pipeline with Docker
CI/CD Pipeline with Dockerkushalsingh007
 
Hackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we MakeHackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we Makeesben1962
 
Version Control Training - First Lego League
Version Control Training - First Lego LeagueVersion Control Training - First Lego League
Version Control Training - First Lego LeagueJeffrey T. Pollock
 
FlashInTO SVN Presentation
FlashInTO SVN PresentationFlashInTO SVN Presentation
FlashInTO SVN PresentationMatthew Fabb
 
Distributed Version Control Systems
Distributed Version Control SystemsDistributed Version Control Systems
Distributed Version Control SystemsMihail Stoynov
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITPouriaQashqai1
 
CEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdfCEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdfluxasuhi
 
Continuous Integration for Oracle Database Development
Continuous Integration for Oracle Database DevelopmentContinuous Integration for Oracle Database Development
Continuous Integration for Oracle Database DevelopmentVladimir Bakhov
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best PracticesMaidul Islam
 
Creating a Scheduled Backup and Replicating System Folders Introduct.docx
Creating a Scheduled Backup and Replicating System Folders Introduct.docxCreating a Scheduled Backup and Replicating System Folders Introduct.docx
Creating a Scheduled Backup and Replicating System Folders Introduct.docxwilliejgrant41084
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version ControlSourabh Sahu
 
Makefile
MakefileMakefile
MakefileIonela
 
Alexander Kutsan: “C++ compilation boost”
Alexander Kutsan: “C++ compilation boost” Alexander Kutsan: “C++ compilation boost”
Alexander Kutsan: “C++ compilation boost” LogeekNightUkraine
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008guestd9065
 
Challenges in multi core programming by Nishigandha Wankhade
Challenges in multi core programming by Nishigandha WankhadeChallenges in multi core programming by Nishigandha Wankhade
Challenges in multi core programming by Nishigandha WankhadeNishigandha Wankhade
 
Source code version control and git
Source code version control and git Source code version control and git
Source code version control and git Naseer Khan Noor
 
Version Uncontrolled - How to Manage Your Version Control (whitepaper)
Version Uncontrolled - How to Manage Your Version Control (whitepaper)Version Uncontrolled - How to Manage Your Version Control (whitepaper)
Version Uncontrolled - How to Manage Your Version Control (whitepaper)Revelation Technologies
 
Enhance your Agility with DevOps
Enhance your Agility with DevOpsEnhance your Agility with DevOps
Enhance your Agility with DevOpsEdureka!
 

Ähnlich wie se2030-11 Intro to version control(1).ppt (20)

Module 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoingModule 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoing
 
CI/CD Pipeline with Docker
CI/CD Pipeline with DockerCI/CD Pipeline with Docker
CI/CD Pipeline with Docker
 
Hackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we MakeHackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we Make
 
Version Control Training - First Lego League
Version Control Training - First Lego LeagueVersion Control Training - First Lego League
Version Control Training - First Lego League
 
FlashInTO SVN Presentation
FlashInTO SVN PresentationFlashInTO SVN Presentation
FlashInTO SVN Presentation
 
Distributed Version Control Systems
Distributed Version Control SystemsDistributed Version Control Systems
Distributed Version Control Systems
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GIT
 
CEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdfCEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdf
 
Continuous Integration for Oracle Database Development
Continuous Integration for Oracle Database DevelopmentContinuous Integration for Oracle Database Development
Continuous Integration for Oracle Database Development
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
Creating a Scheduled Backup and Replicating System Folders Introduct.docx
Creating a Scheduled Backup and Replicating System Folders Introduct.docxCreating a Scheduled Backup and Replicating System Folders Introduct.docx
Creating a Scheduled Backup and Replicating System Folders Introduct.docx
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version Control
 
Makefile
MakefileMakefile
Makefile
 
Alexander Kutsan: “C++ compilation boost”
Alexander Kutsan: “C++ compilation boost” Alexander Kutsan: “C++ compilation boost”
Alexander Kutsan: “C++ compilation boost”
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
 
Challenges in multi core programming by Nishigandha Wankhade
Challenges in multi core programming by Nishigandha WankhadeChallenges in multi core programming by Nishigandha Wankhade
Challenges in multi core programming by Nishigandha Wankhade
 
Source code version control and git
Source code version control and git Source code version control and git
Source code version control and git
 
Version Uncontrolled - How to Manage Your Version Control (whitepaper)
Version Uncontrolled - How to Manage Your Version Control (whitepaper)Version Uncontrolled - How to Manage Your Version Control (whitepaper)
Version Uncontrolled - How to Manage Your Version Control (whitepaper)
 
Enhance your Agility with DevOps
Enhance your Agility with DevOpsEnhance your Agility with DevOps
Enhance your Agility with DevOps
 
Mercurial presentation
Mercurial presentationMercurial presentation
Mercurial presentation
 

Kürzlich hochgeladen

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Kürzlich hochgeladen (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

se2030-11 Intro to version control(1).ppt

  • 1. Introduction to Version Control SE-2030 Dr. Mark L. Hornick 1 Based on material at http://svnbook.red-bean.com/ and git-scm.com/book
  • 2. 2 The stages of developing a software application  Requirements Analysis  High-level Design  [Plan (SE2800)]  Low-level Design  Implementation  Unit Test (SE2832)  Integration  System Test (SE3800)  Deploy (SDL)  Maintain (SDL)
  • 3. In many cases, multiple projects run concurrently New features are typically being added to the next version While at the same time, defects need to be corrected in existing releases You will do this more in SDL SE-2030 Dr. Mark L. Hornick 3
  • 4. On a single project, a team of software engineers work together toward a release All team members work on the same code and develop their respective parts An engineer may be responsible for an entire class Or just a few methods within a particular class SE-2030 Dr. Mark L. Hornick 4
  • 5. Files have to be shared among developers on a team project Shared files can be kept in some type of Repository where they can be accessed and worked on by multiple individuals SE-2030 Dr. Mark L. Hornick 5 Image: http://svnbook.red-bean.com/ Harry and Sally get their own respective local Working Copies of the Master File in the Repository
  • 6. What might you use for a Repository? Would any of these work?  USB/SD drive  Private network drive  E.g. shared “X:” drive  Cloud drive  Google drive  Dropbox  iCloud SE-2030 Dr. Mark L. Hornick 6 Image: http://svnbook.red-bean.com/
  • 7. Sharing files can lead to big problems… SE-2030 Dr. Mark L. Hornick 7 Image: http://svnbook.red-bean.com/ Adds some method Modifies some other method
  • 8. The problem to avoid: SE-2030 Dr. Mark L. Hornick Image: http://svnbook.red-bean.com/ Harry’s changes are still held locally…
  • 9. Harry’s changes are lost SE-2030 Dr. Mark L. Hornick Image: http://svnbook.red-bean.com/ ‘’ ‘’ Harry’s local file gets overwritten with Sally’s latest changes.
  • 10. The Issue: Effective management of software artifacts, especially code Some acronyms:  SCM – Source Code Management  SCCM – Source Code Configuration Management  RCS – Revision Control System  VCS – Version Control System  DVCS - Distributed Version Control Systems SE-2030 Dr. Mark L. Hornick 10
  • 11. Revision/Version History might help  …but USB/SD, private network drives do not maintain revision history  Cloud drives (e.g. Google Drive, Dropbox, iCould/Time Machine) maintain a (limited) history of the various revisions of a file  Google Drive: keeps last 100 revisions or last 30 days  Supported in “Classic” mode only – going away?  IF you detect a collision, you can manually merge the differences and resynchronize your work  Might be workable for two people – what about 5 or 10? SE-2030 Dr. Mark L. Hornick 11
  • 12. Any other disadvantages to Google Drive/Dropbox/iCloud  Security?  Support (bug fixes and new features)?  Ownership of stored information?  Cost?  Ease of Use?  Acceptance? SE-2030 Dr. Mark L. Hornick 12
  • 13. Special-purpose Revision Control Systems have been around a lot longer than Google Drive or Dropbox  SCCS, 1972 (IBM)  RCS, 1982 (Unix)  SourceSafe 1995 (Microsoft)  CVS, 1986 (multi-platform)  SVN, 2000 (multi-platform)  Git and Mercurial, 2005 (multi-platform) The way these work has evolved over the years SE-2030 Dr. Mark L. Hornick 13
  • 14. Features of version control systems  All changes to a file are tracked  Version histories show who, what, when  Changes can be reverted (rewound to any earlier version)  Changes between revisions are easy to identify SE-2030 Dr. Mark L. Hornick 14
  • 15. The Lock-Modify-Unlock solution SE-2030 Dr. Mark L. Hornick Image: http://svnbook.red-bean.com/ Sally must wait until Harry releases the lock, although she can retrieve a “readonly” version of the file in the meantime. Early systems followed this model (RCS, SourceSafe)
  • 16. Lock-Modify-Unlock only allows a single user to edit the file at a time SE-2030 Dr. Mark L. Hornick Image: http://svnbook.red-bean.com/ Sally must continually poll the system to see if the file has been unlocked, or Harry needs to tell her when he unlocks it.
  • 17. Lock-Modify-Unlock has certain drawbacks: Harry has to remember to release his lock before Sally (or anyone else) can acquire the lock in order to edit Sally has to wait for Harry to finish before editing (editing must be done sequentially)  Harry might be adding some new methods (takes a long time)  Harry might forget to release the lock before going home (or on vacation!) SE-2030 Dr. Mark L. Hornick 17
  • 18. The Copy-Modify-Merge solution allows concurrent editing SE-2030 Dr. Mark L. Hornick 18 Image: http://svnbook.red-bean.com/ Harry adds new methods Sally adds comments CVS, SVN use this model
  • 19. The Repository recognizes conflicts SE-2030 Dr. Mark L. Hornick 19 Image: http://svnbook.red-bean.com/ Harry is prevented from writing
  • 20. Conflicting versions of the files are merged SE-2030 Dr. Mark L. Hornick 20 Image: http://svnbook.red-bean.com/ Conflicts are automatically resolved in many cases using robust merging algorithms. However, manual merging is sometimes necessary and can introduce errors.
  • 21. The Repository keeps both users synchronized SE-2030 Dr. Mark L. Hornick 21 Image: http://svnbook.red-bean.com/
  • 22. Copy-Modify-Merge is generally easy to use and manage Users can work in parallel Most of the time, concurrent changes don’t overlap  People generally don’t edit exactly the same code simultaneously, so merging is done automatically in many cases  Amount of time spent resolving conflicts is nearly always less than the time that would be spent waiting for a lock to be released SE-2030 Dr. Mark L. Hornick 22
  • 23. Is Lock-Modify-Unlock ever needed anymore? When two or more people need to work on the same file, the simultaneous changes may not be mergable in all cases:  MS Office documents  Image documents  Other binary files SE-2030 Dr. Mark L. Hornick 23
  • 24. Subversion is an open-source version control system that is available and still supported for many platforms  Windows  Mac  Linux Many current open-source projects use Subversion to maintain source code control  http://subversion.tigris.org/  Latest release 8/2014  MSOE still maintains Subversion on a linux server SE-2030 Dr. Mark L. Hornick 24
  • 25. Subversion’s main drawback is the centralized nature of the Repository A repository is typically hosted on a server.  Version history is on the server, not on your local PC  If the server or network become unavailable, everyone gets stuck with the working copy they have. SE-2030 Dr. Mark L. Hornick 25 Image: http://svnbook.red-bean.com/
  • 26. Distributed Version Control SE-2030 Dr. Mark L. Hornick 26 Image: http://git-scm.com/book/ A “remote master” repository is typically hosted on a server.  Clones of the remote repository are maintained on each user’s computer  If the server goes down, users can continue sharing code (provided they can connect over a network) by synch’ing to each others’ repositories  If the network is unavailable, users can continue reading & writing to their own local repository – synch’ing with others later Git and Mercurial use this model
  • 27. Merging in a DVCS, part 1 SE-2030 Dr. Mark L. Hornick 27 1. Initially, both users’ repositories are synch’d to the remote master; All files are identical. 2. Both users edit the same file, and their local repositories reflect their changes
  • 28. Merging in a DVCS, part 2 SE-2030 Dr. Mark L. Hornick 28 3. User A “pushes” her repository to the remote master to synch; this succeeds. 4. User B attempts to “push” his repository to the remote to synch; this fails due to User A’s earlier push. Remote does not change.
  • 29. Merging in a DVCS, part 3 SE-2030 Dr. Mark L. Hornick 29 5. User B “pulls” User A’s updates from the remote master, merging A and B together. Merging is automatic with some exceptions. 6. User B “pushes” his repository to the remote to synch; this now succeeds
  • 30. Merging in a DVCS, part 4 SE-2030 Dr. Mark L. Hornick 30 7. User B “pulls” from the remote, and everyone is in synch again.
  • 31. Repositories can also manage and track differences between parallel revisions of a document  Typically, a software product will undergo parallel development on different branches (e.g. for new/future features) while primary development takes place on some main branch SE-2030 Dr. Mark L. Hornick 31 Image: http://svnbook.red-bean.com/
  • 32. The master branch should only be used for maintaining production-ready code (and related files)  Code modified or created during a development cycle should be maintained on separate branches  A second standard branch – often named “dev” is typically used to maintain code that is being actively worked on  At the beginning of a cycle, the dev branch is identical to master  During development, the dev branch maintains the evolving code  At the end of a cycle, the dev branch contains the completed code.  The dev branch is then merged into the master branch, and the process repeats with the next cycle (more on this later). SE-2800 Dr. Mark L. Hornick 32 master merge branch merge Version 1 Version 2 Version 3 dev
  • 33. There are two ways to create another branch 1. For example, create a local dev branch and then push that branch to the remote 2. Create a remote dev branch (using the Bitbucket web interface), and then fetch that branch locally  <<Demo of remote branch creation>> SE-2800 Dr. Mark L. Hornick 33 $ git branch dev $ << Note:the command executes silently>> $ git fetch && git checkout dev From bitbucket.org:se2800/MyRepository * [new branch] dev -> origin/dev Branch dev set up to track remote branch dev from origin. Switched to a new branch dev'
  • 34. Git commands for branch status  Use git branch to see what local branch you are currently working on: SE-2800 Dr. Mark L. Hornick 34 $ git branch * dev master  Use git fetch && git branch -r to list all remote branches: $ git fetch $ git branch -r origin/master origin/dev
  • 35. Git commands for switching branches  Use git checkout master to switch your working directory to the master branch: SE-2800 Dr. Mark L. Hornick 35 $ git checkout master dev * master  Use git checkout dev to switch your working directory to the dev branch: $ git checkout dev * dev master NOTE: If you currently have nothing to commit, and you switch branches, the code in your working directory will be replaced with the code that is in the branch you’re switching to.