Currently I always worked with GIT and was quite satisfied.
Due to some project restrictions we took over an already start开发者_运维技巧ed project which recently hit the 1.0 production version.
Now I would like to branch the stable version 1.0 and we keep on developing in the trunk.
Now my structure looks like:
branche
--app-1.0
trunk
--app
Now two scenarios: I keep on developing in the trunk. I fix a bug which also hits version 1.0. in one Java class. It's only 1 line of code that changes. How do I commit this to app-1.0 without overriding the "old" class except with this one single line?
2nd scenario: Someone asks me to check if there's a bug. I switch to app-1.0, find the bug, fix it, I find by chance a second bug, fix it too, commit it to app-1.0. How do I commit this to the trunk?
Is in both cases the merge command correct?
What are best practices?
On my GIT I alway had it the other way round: I created a branch app-1.0 app-2.0 where I develop and when I found it to be stable I merged it to the trunk which was always a representation to my stable version.
I hope you guys can help me :-)
For both scenarios : you merge!
From SVN Book:
Merge a branch back into the trunk (assuming that you have a working copy of the trunk, and that the branch was created in revision 250):
$ svn merge -r 250:HEAD http://svn.red-bean.com/repos/branches/my-branch
U myproj/tiny.txt
U myproj/thhgttg.txt
U myproj/win.txt
U myproj/flo.txt
If you branched at revision 23, and you want to merge changes on trunk into your branch, you could do this from inside the working copy of your branch:
$ svn merge -r 23:30 file:///tmp/repos/trunk/vendors
U myproj/thhgttg.txt
http://svnbook.red-bean.com/en/1.0/re16.html
You can easily merge single revision from trunk to branch or from branch to trunk. Merge is the right command.
If you have branch checked out, you can do:
svn merge -r <from_revision>:<to_revision> http://host/path/to/trunk
or
svn merge -c <revision> http://host/path/to/trunk
(-c
is equivalent to -r <revision-1>:<revision>
).
In SVN, merge works by getting difference between two revisions, and applying them to your working directory. After merge, you have to commit your changes. If you want to merge bugfix from branch to trunk, go to your trunk working directory, and merge from branch URL.
精彩评论