使用git-svn仅提交某个本地(即git)分支 [英] dcommit only a certain local (i.e. git) branch with git-svn
问题描述
我正在使用 git
进行开发,但我必须通过 svn
进行发布。
这就是为什么我设置 git-svn
(由 git svn clone
)。
我通常的工作流程是这样的:
git svn rebase#获取本地git仓库最新
git添加文件#添加一些代码
git commit#将代码提交到本地git仓库
git svn dcommit#从本地git推送更改存储到公共svn仓库
到目前为止,这工作正常。
然而,我想在我的本地 git
存储库中创建一个分支(比如说 secret
),被完全忽略 git-svn
。
我想我必须这样做:
git svn rebase#获取本地git仓库最新
git分支秘密#创建秘密分支在本地git仓库
git结帐秘密#切换到本地git仓库$中的秘密分支b $ b git add secret.file#添加一些密码
git commit#将密码提交到本地git存储库的秘密分支
git checkout master#切换回本地git存储库中的公共分支
git svn rebase#获取本地git仓库的公共分支最新
git add public.file#添加一些公共代码
git commit#将公共代码提交到本地git仓库的公共分支
git svn dcommit#将公共更改从本地git存储库推送到公共svn存储库
secret.file
完全隐藏于 svn
?
如果是这样,我想我可以将 git merge
它变为 master
和 git svn dcommit
它一旦获得'未分类的,它就会转换为 svn
。这是正确的吗?
另外,是否可以将 master
重命名为 public
为清楚起见?
如果是这样,怎么样?请注意,这两个存储库中已有该分支的历史记录。
是的,您的秘密更改会保留在您的本地git中,直到您执行 git checkout secret& &安培; git svn dcommit
或将您的更改合并到其他分支( master
/ public
)和dcommit从那里。
您可以简单地将公共名称重新命名为public:
git checkout master
git checkout -b public
git commit等等...
git svn dcommit
分支会记住它们是从哪个分支开始的,你可能总是用 git svn info
来检查。你可以选择在切换到public之后删除master: git branch -D master
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.
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
这篇关于使用git-svn仅提交某个本地(即git)分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!