简体   繁体   English

如何将git-svn分支恢复为SVN HEAD?

[英]How do I revert a git-svn branch to SVN HEAD?

I have a local git repository which tracks a remote SVN repository via git svn . 我有一个本地git存储库,它通过git svn跟踪远程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. 我已经在本地git存储库中进行了一些更改,但是现在我想创建一个反映SVN HEAD的分支,以便对SVN中的代码进行一些更改,因为我不想传播我的git master到SVN的变化还没有。 How can I go about this? 我怎么能这样做?

Immediate follow-up: I will need to make and commit changes to SVN HEAD, then merge them back into my git master. 立即跟进:我需要对SVN HEAD进行更改并提交,然后将它们合并回我的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 ? 我是否git merge 'svn-edits'分支合并为master,或者我是否执行git svn rebase

I will assume that the branch you are working on is the one for trunk (I will call it old-trunk ). 我假设您正在处理的分支是trunk的分支(我将其称为old-trunk )。 Simply create a new branch from there 只需从那里创建一个新的分支

git checkout -b real-trunk remotes/trunk

Now make your changes to real-trunk and commit from there. 现在对那里的real-trunk和提交进行更改。 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. 现在,您之前的更改基于您刚刚进行的更新更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM