SlideShare a Scribd company logo
Source control
Content
 Version control
 Advantages & disadvantages of GIT
 GIT basics
 Subversion
 TortoiseSVN
 How to use SVN
 Rules on using SVN
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 Control7
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 Control9
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
 Developed in 2000 and 2001 (by CollabNet,
Inc.)
to replace CVS and its shortcomings
• Subversion is free
• Subversion is open-source
• Subversion operates across a network
• Subversion handles any types of files,
documents, or directories
• Subversion requires administrative
support
What is subversion22
 On its own, Subversion is command-line driven
• UNIX:
• MS-DOS:
 Numerous GUIs have been built on top of SVN
• TortoiseSVN
• VisualSVN
• XCode (Mac OS X)
Using Subversion
http://tortoisesvn.net/
23
TortoiseSVN is
• Open-source (free)
• Integrated directly
into Windows Explorer
• Usable with any development environment
TortoiseSVN
http://tortoisesvn.net/
24
Open source application – download it from
• http://tortoisesvn.net/downloads
After the installation a new
option appears in the menu when
 you right click on a folder.
25
 Checkout:
• Receives a copy of an entire project from the
SVN server.
• (Source files, project & make files, resource files,
etc.).
 Update:
• Receives copies of individual files or folders on
the server and merges them with your current
copy (locally).
How to use SVN26
 Commit:
• Sends an updated file (your local copy) to the
SVN server where.
• It is incorporated into the original project
database;
a new version number is assigned not the entire
project.
 Add:
• Notifies SVN of a new file or folder that needs to
be added to the existing project (only if SVN is
aware of a file, can you commit the file).
How to use SVN Cont.27
Right click in the folder you want to check out
into
Select SVN Checkout…
How to checkout28
 URL of repository:
http://svn.cs.wayne.edu/svn/csc4111w11/
29
Enter the user name and password:
• Your accessID (xx1234) and the same
password you use for Pipeline/Blackboard
30
• Select the project you want to download:
31
 If you have a set of files checked out and
would like to update them to the most
recent version of files in the repository, use the
update command.
 If there are newer files in the repository, they will
overwrite any files you have locally, if you
haven’t changed them.
 TortoiseSVN can merge some files on its own,
but may tell you there are conflicts with others.
 If a file has a conflict use diff.
Update32
How to update
 Right click on the file, folder or project you want to
update and choose SVN Update
33
 Once you have added, deleted, or changed
files or directories, you can then commit those
changes to the repository.
 Before committing you should always update.
 The safest way to commit, is to diff your project
before you commit.
 Always check your project out after a commit
and make sure it compiles.
Commit34
 All commits need to be commented.
 If you forget to comment, make a trivial change
to a file and commit adding in your comment
that it applies to the previous commit.
Commit Comments35
 Include:
• Your Name
• The type of commit (Change, Bug Fix, …)
• What the commit does (Adds ToolTip dialog …)
• Any other important details
 Don’t include:
• The names of the files (The log will have them)
• The date or time
36
How to commit
 Right click on the file, folder or project you
want to update and choose SVN
Commit…
37
 Right click on the file you want to diff.
 Select Diff, this will compare your file to the most
recent (Head) version on the repository. In a
new window.
How to Diff38
If just a word changed, it will be in red on one
side yellow on the other
You can use the green arrows to navigate
through the differences.
Diff - How to solve conflicts39
If lines were added/deleted one side will have
gray the other yellow.
The Edit menu has options to help you combine
the files.
40
 Before you commit make sure you add the file
into the repository
 After you add - commit
Adding new files41
 If your commit breaks the baseline.
 Update your local copy
 Check out the last good version
 Commit this version
If you make a bad commit42
 Carefully test your code before committing
 Before committing, perform an update on the
whole source code directory, and then retest
 Always commit only the individual files you
modified, not the entire directory
 When adding new files to the existing source
code, always perform SVN Add and then SVN
Commit
 When you have conflicts, contact the
teammates which modified that file and try to
solve the conflicts together to avoid damages.
Rules on using SVN43
 Do not share your login and password – you are
responsible for all changes made with your ID
 Do not check out projects of other groups !!!
 If you check in modifications to the project of
other group you might be responsible for that
 If you do not understand something, please ask
GTA before doing that
 If you do not like a client that we’re suggesting
you to use, you’re free to use any other
available SVN client (but please notify me and
write a couple of lines explaining why)
44
 www.powershow.com/view4/456743
OGRkM/Version_Control_using_Subversion_SVN_po
werpoint_ppt_presentation.
 https://www.google.com/search?
q=souce+control&ie=utf-8&oe=utf-
8#q=source+control+svn+ppt.
 http://www.powershow.com/view1/7d30b-
ZDc1Z/Version_Control_using_Subversion_SVN_pow
erpoint_ppt_presentation.
 “Version control with git”, Jon Leoliger, O'Reilly
2009.
 “Pro Git”,2nd
Edition, Scott Chacon, Ben Straub.
References45
Source control

More Related Content

PDF
How to use CVS applied to SOLab
PPT
Subversion on .Unix
PDF
Linux Kernel Participation HowTo
PDF
Git your life for fun & profit
PPT
Linux13 concurrent versions system
PDF
A brief introduction to version control systems
PDF
Hacking+linux+kernel
KEY
Getting Git
How to use CVS applied to SOLab
Subversion on .Unix
Linux Kernel Participation HowTo
Git your life for fun & profit
Linux13 concurrent versions system
A brief introduction to version control systems
Hacking+linux+kernel
Getting Git

What's hot (7)

PPTX
What is the merge window?
PPTX
Git walkthrough
PDF
Version Uncontrolled - How to Manage Your Version Control (whitepaper)
PDF
Synchronization
PDF
Kernel Recipes 2015: The stable Linux Kernel Tree - 10 years of insanity
PPTX
Git vs cvs ece2011
PDF
Dita Release Management
What is the merge window?
Git walkthrough
Version Uncontrolled - How to Manage Your Version Control (whitepaper)
Synchronization
Kernel Recipes 2015: The stable Linux Kernel Tree - 10 years of insanity
Git vs cvs ece2011
Dita Release Management
Ad

Viewers also liked (7)

PDF
Scaling Source Control for the Next Generation of Game Development
PDF
Mercurial: Modern Source Control Management
PDF
Understanding Distributed Source Control
PDF
Adding Source Control to Your Life
PDF
Git, GitHub and Open Source
PPTX
Source Control 101
PPTX
Version Control System
Scaling Source Control for the Next Generation of Game Development
Mercurial: Modern Source Control Management
Understanding Distributed Source Control
Adding Source Control to Your Life
Git, GitHub and Open Source
Source Control 101
Version Control System
Ad

Similar to Source control (20)

PPTX
Source control
PDF
Git your life for fun & profit
PPT
PPT
git.ppt
PPT
PPTX
Subversion
PPT
PPT
Subversion client
PDF
Subversion to Git Migration
PDF
Software Versioning with Bitbucket and Eclipse
PPTX
Subversion
PPTX
Basics of git
PPT
PPTX
SVN Tutorial
PPTX
Git presentation to some coworkers some time ago
PDF
Git collaboration
PPT
391Lecture0909 Vision control of git.ppt
PPT
Introduction to git
PPTX
Git 101 for Beginners
Source control
Git your life for fun & profit
git.ppt
Subversion
Subversion client
Subversion to Git Migration
Software Versioning with Bitbucket and Eclipse
Subversion
Basics of git
SVN Tutorial
Git presentation to some coworkers some time ago
Git collaboration
391Lecture0909 Vision control of git.ppt
Introduction to git
Git 101 for Beginners

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Approach and Philosophy of On baking technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
KodekX | Application Modernization Development
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Spectroscopy.pptx food analysis technology
PDF
Empathic Computing: Creating Shared Understanding
PPT
Teaching material agriculture food technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Spectral efficient network and resource selection model in 5G networks
Big Data Technologies - Introduction.pptx
Encapsulation_ Review paper, used for researhc scholars
Approach and Philosophy of On baking technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
KodekX | Application Modernization Development
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
Programs and apps: productivity, graphics, security and other tools
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectroscopy.pptx food analysis technology
Empathic Computing: Creating Shared Understanding
Teaching material agriculture food technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

Source control

  • 2. Content  Version control  Advantages & disadvantages of GIT  GIT basics  Subversion  TortoiseSVN  How to use SVN  Rules on using SVN 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
  • 22.  Developed in 2000 and 2001 (by CollabNet, Inc.) to replace CVS and its shortcomings • Subversion is free • Subversion is open-source • Subversion operates across a network • Subversion handles any types of files, documents, or directories • Subversion requires administrative support What is subversion22
  • 23.  On its own, Subversion is command-line driven • UNIX: • MS-DOS:  Numerous GUIs have been built on top of SVN • TortoiseSVN • VisualSVN • XCode (Mac OS X) Using Subversion http://tortoisesvn.net/ 23
  • 24. TortoiseSVN is • Open-source (free) • Integrated directly into Windows Explorer • Usable with any development environment TortoiseSVN http://tortoisesvn.net/ 24
  • 25. Open source application – download it from • http://tortoisesvn.net/downloads After the installation a new option appears in the menu when  you right click on a folder. 25
  • 26.  Checkout: • Receives a copy of an entire project from the SVN server. • (Source files, project & make files, resource files, etc.).  Update: • Receives copies of individual files or folders on the server and merges them with your current copy (locally). How to use SVN26
  • 27.  Commit: • Sends an updated file (your local copy) to the SVN server where. • It is incorporated into the original project database; a new version number is assigned not the entire project.  Add: • Notifies SVN of a new file or folder that needs to be added to the existing project (only if SVN is aware of a file, can you commit the file). How to use SVN Cont.27
  • 28. Right click in the folder you want to check out into Select SVN Checkout… How to checkout28
  • 29.  URL of repository: http://svn.cs.wayne.edu/svn/csc4111w11/ 29
  • 30. Enter the user name and password: • Your accessID (xx1234) and the same password you use for Pipeline/Blackboard 30
  • 31. • Select the project you want to download: 31
  • 32.  If you have a set of files checked out and would like to update them to the most recent version of files in the repository, use the update command.  If there are newer files in the repository, they will overwrite any files you have locally, if you haven’t changed them.  TortoiseSVN can merge some files on its own, but may tell you there are conflicts with others.  If a file has a conflict use diff. Update32
  • 33. How to update  Right click on the file, folder or project you want to update and choose SVN Update 33
  • 34.  Once you have added, deleted, or changed files or directories, you can then commit those changes to the repository.  Before committing you should always update.  The safest way to commit, is to diff your project before you commit.  Always check your project out after a commit and make sure it compiles. Commit34
  • 35.  All commits need to be commented.  If you forget to comment, make a trivial change to a file and commit adding in your comment that it applies to the previous commit. Commit Comments35
  • 36.  Include: • Your Name • The type of commit (Change, Bug Fix, …) • What the commit does (Adds ToolTip dialog …) • Any other important details  Don’t include: • The names of the files (The log will have them) • The date or time 36
  • 37. How to commit  Right click on the file, folder or project you want to update and choose SVN Commit… 37
  • 38.  Right click on the file you want to diff.  Select Diff, this will compare your file to the most recent (Head) version on the repository. In a new window. How to Diff38
  • 39. If just a word changed, it will be in red on one side yellow on the other You can use the green arrows to navigate through the differences. Diff - How to solve conflicts39
  • 40. If lines were added/deleted one side will have gray the other yellow. The Edit menu has options to help you combine the files. 40
  • 41.  Before you commit make sure you add the file into the repository  After you add - commit Adding new files41
  • 42.  If your commit breaks the baseline.  Update your local copy  Check out the last good version  Commit this version If you make a bad commit42
  • 43.  Carefully test your code before committing  Before committing, perform an update on the whole source code directory, and then retest  Always commit only the individual files you modified, not the entire directory  When adding new files to the existing source code, always perform SVN Add and then SVN Commit  When you have conflicts, contact the teammates which modified that file and try to solve the conflicts together to avoid damages. Rules on using SVN43
  • 44.  Do not share your login and password – you are responsible for all changes made with your ID  Do not check out projects of other groups !!!  If you check in modifications to the project of other group you might be responsible for that  If you do not understand something, please ask GTA before doing that  If you do not like a client that we’re suggesting you to use, you’re free to use any other available SVN client (but please notify me and write a couple of lines explaining why) 44
  • 45.  www.powershow.com/view4/456743 OGRkM/Version_Control_using_Subversion_SVN_po werpoint_ppt_presentation.  https://www.google.com/search? q=souce+control&ie=utf-8&oe=utf- 8#q=source+control+svn+ppt.  http://www.powershow.com/view1/7d30b- ZDc1Z/Version_Control_using_Subversion_SVN_pow erpoint_ppt_presentation.  “Version control with git”, Jon Leoliger, O'Reilly 2009.  “Pro Git”,2nd Edition, Scott Chacon, Ben Straub. References45

Editor's Notes

  • #4: 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.
  • #5: It iseasy 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.
  • #11: A distributed version control system
  • #13: 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.
  • #14: 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.
  • #15: 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.
  • #17: 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
  • #18: 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
  • #19: A commit is when you tell git that a change (or addition) you have made is ready to be included in the project