in the use of source code version control tool, the best practice is to remain a trunk version. But in order to cope with the actual development of the various situations, timely introduction of some branches is also necessary. For example, in the same time continuing to develop new features, you need to release a new version, then you need to create a trunk from the development branch for publishing, on a branch for bug fix, maintain a stable version, and some changes will be timely merged back trunk. Currently ubiquitous source code version control tool git popular with everyone respected, one of the reasons is its function in this regard is quite powerful. In fact, there is such a veteran of SVN is a function, then gave you on the next.
Branch was created
in SVN trunk code is generally placed in the Trunk directory, so if you want the new Branch is placed in Branchs directory. (Note that this is a convention, SVN does not force you to do so) Note Branhs Trunk directories should be flat and level, there can be nested, to not cause confusion.
1 | |
quite simple, just a command.
1 | |
This command is to create a directory named myproject releaseForAug this repo's branch, use the-m to add descriptions.
then you can pass svn checkout http://example.com/repos/myproject/branches/releaseForAug
to move out of your Branch source files, the above modifications and submitted.
internal concept. We just created a repo copy, and giving yourself a copy as a Branch of the significance of this, so this is the git Branch are very different.
Note that Branch and Trunk version using the same set, ie both in the Branch or Trunk submission will cause major version number increases. This is because svn copy
supports only within the same repository file copy, does not support cross-repository of copy, so the newly created Branch and Trunk belong to the same repository.
merge
Sincealso need to create a branch merge branch. Basic combination is also quite simple.
Suppose now that Branchfix on a series of bug, now we want to change for the Branch synchronized to the Trunk, then how should I do that?
-
ensure that the current Branch branch is clean, that is to use svn status can not see any local modifications.
-
command line switch to the Trunk directory, use
svn merge http://example.com/repos/myproject/branches/releaseForAug
to the Branch branch changes to merge back Trunk next. -
If merge is to resolve the conflict, and then perform
svn ci-m 'description'
to submit the change.
course, you can also specify the Branch merge those on version changes can be merged into Trunk.
1 | |
example is the Branch from version 150 to the current version of all the changes are merged into the Trunk.
you can also Trunk some of the updates into the Branch, or whether the same method.
View the current Branch and Trunkmerger case
can use svn mergeinfo
to view the merge situation.
those changes have already been merged into Trunk.:
1 | |
View Branch merge those changes yet.
1 | |
没有评论:
发表评论