问题
I am developing using git
but I have to publish via svn
.
That's why I've set up git-svn
(by git svn clone
).
My usual workflow is like this:
git svn rebase # get local git repository up-to-date
git add file # add some code
git commit # commit code to local git repository
git svn dcommit # push changes from local git repository to public svn repository
So far this works fine.
However, I would like to create a branch (say secret
) in my local git
repository that is completely ignored by git-svn
.
I guess I have to do something like this:
git svn rebase # get local git repository up-to-date
git branch secret # create secret branch in local git repository
git checkout secret # switch to secret branch in local git repository
git add secret.file # add some secret code
git commit # commit secret code to secret branch of local git repository
git checkout master # switch back to public branch in local git repository
git svn rebase # get public branch of local git repository up-to-date
git add public.file # add some public code
git commit # commit public code to public branch of local git repository
git svn dcommit # push public changes from local git repository to public svn repository
Would this workflow keep secret.file
completely hidden from svn
?
If so, I guess I could just git merge
it into master
and git svn dcommit
it to the svn
it once it gets 'un-classified'. Is that correct?
Also, would it be possible to rename master
to public
for clarity?
If so, how? Note that there is already a history for that branch in both repositories.
回答1:
Yes, your secret changes will stay in your local git until you do git checkout secret && git svn dcommit
or merge your changes to other branch (master
/public
) and dcommit from there.
Instead of renaming master to public, you could simply start public:
git checkout master
git checkout -b public
git commit, etc...
git svn dcommit
Branches will "remember" svn branch they were started from, you may always check this with git svn info
. You could optionally drop master after switching to public: git branch -D master
来源:https://stackoverflow.com/questions/24691660/dcommit-only-a-certain-local-i-e-git-branch-with-git-svn