我如何将一个git-svn分支转换为SVN HEAD? [英] How do I revert a git-svn branch to SVN HEAD?

查看:177
本文介绍了我如何将一个git-svn分支转换为SVN HEAD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地git仓库,它通过 git svn 跟踪远程SVN仓库。我已经在本地git仓库中做了一些更改,但现在我想创建一个反映SVN HEAD的分支,以便对SVN中的代码进行一些更改,因为我不想传播我的git master的变化还没有到SVN。我该如何解决这个问题?

I have a local git repository which tracks a remote SVN repository via git svn. I have made and committed some changes in the local git repository, but now I'd like to create a branch that reflects SVN HEAD in order to make some changes to the code as it stands in SVN, because I don't want to propagate the changes in my git master to SVN just yet. How can I go about this?

立即跟进:我需要对SVN HEAD进行更改并提交,然后将它们合并回我的git主文件中。我如何去做这件事?我是否将 git merge 'svn-edits'分支转换为master,还是执行 git svn rebase

Immediate follow-up: I will need to make and commit changes to SVN HEAD, then merge them back into my git master. How do I go about this? Do I git merge the 'svn-edits' branch into master, or do I do a git svn rebase?

推荐答案

我假设你正在使用的分支是 trunk (我会称它为 old-trunk )。从这里创建一个新的分支

I will assume that the branch you are working on is the one for trunk (I will call it old-trunk). Simply create a new branch from there

git checkout -b real-trunk remotes/trunk

现在对 real-trunk 进行更改并从那里提交。然后,简单地重新绑定新分支。

Now make your changes to real-trunk and commit from there. Afterwards, simply rebase your old branch on the new one.

git svn dcommit
git checkout old-trunk
git rebase real-trunk

现在,您之前的更改基于您刚才所做的更新。

Now your earlier changes are based on the more recent changes you just did.

这篇关于我如何将一个git-svn分支转换为SVN HEAD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆