Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Version Control
Joel NationSolution ArchitectOracle Canberra
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 2
In Continuous Integration
Local WLS
Temp WLSCompileCreate WLSCreate DomainDeployTestUndeployRemove DomainUninstall
Version Control System
?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 3
Why?• Reversibility or rollback
•Multiple developers can work on the same project
• Comments
• Transparency • Who broke the code?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 4
A (brief) history of Version Control
Manual Server-based Distributed
Git MercurialSubversionCVSFile Locks
Every file is versioned seperately. Eg: File A is at rev 5, File B is at rev 9
No history or rollback mechanisms
Every change increments the revision number. Ie: All files at the same revision Everyone has their own
repository with their own version control
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 5
Traditional Version Control
Version 1 Version 2 Version 3 Version 4 Version 5
Checks in over time
File A
File B
File C
Δ1
Δ3
Δ2
Δ2
Δ2
Δ1
Δ1
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 6
Git
Version 1 Version 2 Version 3 Version 4 Version 5
Checks in over time
File A
File B
File C
A1
C3
B2
A2
C2
B1
C1
B B
A2
C2
A1
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 7
Git Workflow• Repository is local copy of
repostitory– Can be entirely local– Contains a compressed version of all
files
• Staging area stores what is going in the next commit– Can be referred to as the index
• Working directory is the current checkout of the project
Working Directory Staging Area Repository
Stage Files
Commit
Checkout the Project
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 8
Branching
98ca9 34ac2 f30ab
master git branch testing
testing
HEAD
git checkout testing
HEAD
testing
HEAD
c2b9egit commit –a –m ‘made a change’
git checkout master
git commit –a –m ‘another change’
87ab2
HEAD
master
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 9
Pros/Cons
Subversion
• Pros– Simple to understand
• Cons– Merging can be hard• Developers more likely to just check in at the end
– .SVN directories everywhere• Repos can be much larger in size
Git
• Pros– Nearly every operation is local• You can review history and check in without an
internet connection
– Merges are easy! • Encourages experimentation• Minimises check in risk
• Cons– Complex and can be difficult to understand
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 10
Tips for working in Git• Make fine-grained commits rather
than a few large ones• Commit locally before committing
to a remote repo• Create local experimental branches
as required– Branch names are local, so don’t worry
about everyone having a ‘test’ branch
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 11
JDeveloper Support11g 12c
CVS Yes Yes
Perforce Yes Yes
Microsoft Team System VCS Yes Yes
Oracle CVS Yes Yes
Git Built-in (from 11.1.1.6) Built-in
Subversion Built-in Built-in
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 12
Git Demo
Top Related