Git svn work flow, making branchs in git-svn
git version 1.7.3.3
I had a project that was using git.
Our company changed its policy and wanted everyone to switch to svn.
So I imported my project in subversion using the standard layout (trunk, branchs, and tags).
So my current workflow is the following:
Make some changes, put them in the staging area, then commit them to git开发者_如何学JAVA. However, I get a little confused when it comes to svn. First I rebase to get the latest changes from subversion. Then I do a dcommit.
i.e.
Stage the change files
git stage app_driver.c
Commit them to git
git commit -m"Added some changes"
Get the latest changes from svn
git svn rebase
commit the my latest changes to svn
git svn dcommit
push the changes to my git repository
git push upstream my_project
However, the real confusion comes when I make a new branch in git, and how I can commit to that branch in subversion.
git checkout -b add_new_feature
Then how do I make the new branch in svn and commit it?
Many thanks for any suggestions,
What I do normally is create a branch in subversion using svn copy.
For example, suppose my trunk is in https://svnserver/svn/MyProject/trunk and I want to create a branch in https://svnserver/svn/MyProject/branches/my-branch, I would do:
svn copy https://svnserver/svn/MyProject/trunk https://svnserver/svn/MyProject/branches/my-branch
Ok, this would get rid of creating the svn branch, but to fetch this branch with git I would go to my directory and do a git svn fetch. This would fetch things from svn but would not modify your current branches.
If you started your project with git svn init --stdlayout your branch will appear when you do a git branch -r. You can then checkout it with something like this:
git checkout -b my_local_branch_name my_remote_branch_name
Note: do not use the same name for your local branch and for your remote branch or git will complain (although it works.)
Then you can work as normal.
I'd make the branch in subversion first in this case, since it sounds like you want to have a long-term development branch which is merged in later with the contents of /trunk.
When I want to do a short term fix to whatever is in /trunk I do what you want to do:
git checkout -b add_quick_change
and change away.
Then when I want to put it in /trunk:
git checkout master
git pull --no-squash . add_quick_change
git svn dcommit
This should copy all the history into master so it ends up in subversion after the dcommit.
精彩评论