Version Control System (a portmanteau of the Control the System the Version, the VCS.) - This code storage. Like a dropbox , for developers only!
It is geared specifically towards product development. That is, for storing code, synchronizing the work of several people, creating releases (branches) ... But let me tell you better with an example why it is better than a dropbox. Everything is as always, a story with a bunch of pictures for clarity))
And then I'll tell you more about how VCS works - what it means to "create a repository", "commit and merge changes", and other scary words. In the end, we will touch one of the VCS systems with our hands, download the code from the open repository.
Total content:
What is it and why is it needed
-
Popular VCS and the differences between them
Example - downloading a project from Git
-
What is it and why is it needed
, Java ( ). β , . , :
;
β ;
β , , .
, . , . β . !
, . :
Main.java β
GUI.java β
!
, β , ! , . (Sum.java), ( GUI.java) Main.java.
-, , ... β ! β ! . ( β Minus.java), Main.java GUI.java.
, , .
, . , .
β , ??
β , ! . !
:
β ? !
. , , : Main.java GUI.java. β .
. , . , .
, , . Sum.java, .
! , . Main.java GUI.java, . , , .
( β , -):
β ?
β , , ! . , 9 . . 9 , , .
β , !
, ! . , ... .
, . , - ! , .
, . :
β !!! !
, :
β ??
. , , , . , . .
. , , . , .
β ! , ?
β , ...
:
β ! :
, .
- β «» , - .
, β , .
. .
:
β ... , , . !
:
β . , Dropbox, ?
. , . . . , , , .
:
β ?
β . , !
:
β , Main.java, . ... ! 100 ... .
β , , , .
β , !
. :
β ?
β , !
β ?
β ??? !
β .
β . - Main.java. :
β , .
β , , !
β , .
β ? , ...
β , ? ...
, . - . !
β , , - , ? Β« Β»?
β . . AraxisMerge, !
β , ! IDEA ( Ctrl + C ). !
β !
β . :
β , ! , ! . , !
β ? ?
β . SVN, . ?
β !
. ! , . ? !
VCS
, .
1.
, . . .
SVN. , , . , «» .
, VCS . , β , .
! ! .
2.
. , , , , -!
, , . , . Mercurial ( VCS) β clone. , β () , , !
, . -.
, β .
, .
1. ,
, . - ?
, , Main.java GUI.java. , . !
SVN Β«updateΒ», Mercurial β Β«pullΒ». . , . - β . - , .
β clone? , ! ?
. , - . , . , .
, «» . , . , .
β . 5 1000, ?
2.
. , . , ( β , . refactor), Main.java.
() , . . β VCS, .
1 β commit
β SVN.
, . Β«commitΒ» β . .
2 β commit + push
β Mercurial, Git.
, . Β«commitΒ» β . !
, «». «push».
, , . , code freeze . . , , !
. , , . =) .
, :
β .
:
β .
. β , !
3. (merge)
, β . , 3 Main.java Gui.java.
Minus.java, , .
. , . :
Percent.java
Main.java ( 3)
Gui.java ( 3)
:
Percent.java β 1
Main.java β 4
Gui.java β 4
. :
Division.java
Main.java ( 3, )
Gui.java ( 3)
, ! :
Division.java β 1
Main.java β 4
Gui.java β 4
, , ! !
, Β«mergeΒ». , , Main.java Gui.java , . . «» β 4 .
, ? . , . :
, β ,
, β ,
β
β . , , . β .
, , . , -. . , , , β ? ?
β , . , ant gradle, . , .
, 200 , .
? . , .
, , . , . . merge , !
4. ()
. , . ? :
β ? ?
β . , .
:
β , , ? !
:
β !
:
β ?
:
β β . , trunk-, .
- , Β« Β» β , .
β 1 .
β 2.
VCS , :
1
1 2 β , ,
, 2 .
β 3.
β , . , . (branch . β ). trunk-.
, , - . ( , . branch, trunk, )
trunk. branch, , - .
!
β , ! ? ! , 2. !
β . , Β« Β». , . , ( ).
, , 3, . , . 30 .
, β , . ! , :
3
( , )
=
33 ()
- . ? , ? ? ?
! - , . , , , .
β . branch (trunk). , , merge, !
- β . + .
. , β 1, 2... 52...
, , , . , =) ( ):
!
β , ?
β , . , Mercurial Β«hg sumΒ»: , . :
D:\vcs_project\test>hg sum
parent: 3:66a91205d385 tip
Try to fix bug with device
branch: default
Β«parentΒ» β . . , ? . 3. , ID .
, . Β«Try to fix bug with deviceΒ».
, , Β«branchΒ»! default β . trunk-. , . . .
β ! !
*****
Git «», , β https://learngitbranching.js.org
*****
, β VCS. β , . .
( . Version Control System, VCS) β dropbox .
VCS
β :
SVN β ,
Mercurial ( HG), Git β ( )
SVN β , . β . ! . , . , , .
Mercurial Git β . β , push. , , , . . .
Β« Β». , . , , , , , ... .
. . «» β Tortoise<VCS>. TortoiseSVN, TortoiseHG, TortoiseGit... β IDEA, Eclipse, etc.
? , Tortoise Β«-Β», .
:
API β , .
VCS:
|
SVN |
GIT |
HG |
|
svn checkout <> <> |
git clone <> <> |
hg clone <> <> |
|
svn update |
git pull |
hg pull -u |
( ?) |
svn log --revision HEAD |
git show -s |
hg sum |
|
svn commit -m "MESSAGE" |
git commit -a -m "MESSAGE"
|
hg commit -m "MESSAGE"
|
branch |
svn checkout <> <> |
git checkout BRANCH |
hg update BRANCH |
, , . , , =)
β Git
Folks. !
Git. , . 3 ( , ):
IDEA
TortoiseGit
D:\git.
1.
1. git:
2. :
git clone
β
git clone https://bitbucket.org/testbasecode/folks/src/master/ D:\\git\\folks_console
. !
Β« Β» . .
2. IDEA
1. IDEA
2. Check out from Version Control β Git
3. :
URL β https://bitbucket.org/testbasecode/folks/src/master/ ( )
β D:\git\folks_idea ( )
4. Clone β ! IDEA !
, !
, Β«ProjectΒ» ( ) , :
β , ! , . .
3. TortoiseGit
β , «» (tortoise):
1. TortoiseGit
2. β , , : Git Clone, Git Create repository here, TortoiseGit
3. , . , D:\git.
4. β Git Clone
:
URL β https://bitbucket.org/testbasecode/folks/src/master/ ( )
Directory β D:\git\folks_tortoise_git ( )
5. «»
! - β !
3 ! , , :
SVN, Mercurial, Git, VCS β . , . ! =) .
. Β«TODO Β». , . , , .
. , . , , . , , . .
, . , !
. , VCS , . , «» β .
, . . . VCS Tortoise Hg.
=) β 1 .
, , β . , !
PPS: the author of the pictures for this article is Anya Chernomortseva , the author of the style is Victoria Lapis =)