【问题标题】:git-svn rebase and dcommit problemgit-svn rebase 和 dcommit 问题
【发布时间】:2010-12-14 06:16:00
【问题描述】:
git version 1.7.1
svn, version 1.6.12
Ubuntu 10.10

我只有 git,我用过 svn。但是我没有一起用过。我有一个 git 存储库,我不得不将我的存储库更多地添加到一个 subversion 存储库。所以我一直在使用 git-svn。大多数情况下,哪个工作正常。但是,我发现在兜圈子。

我是唯一一个在这个项目上工作的人。

我对我的分支进行了一些更改。然后我将它们上演:

git stage gateway.c

然后将它们本地提交到 git:

git commit m"Made some changes"

然后我想将它们提交给颠覆。获取最新更新:

git svn rebase

然后我收到以下消息:

It seems that I cannot create a rebase-apply directory, and
I wonder if you are in the middle of patch application or another
rebase.  If that is not the case, please
        rm -fr /home/joe/projects/gateway/.git/rebase-apply
and run me again.  I am stopping in case you still have something
valuable there.
rebase refs/remotes/trunk: command returned error: 1

I then doing the following:
rm -fr /home/joe/projects/gateway/.git/rebase-apply

然后我再次做一个变基:

git svn rebase

消息是这样的:

First, rewinding head to replay your work on top of it...
Applying: Issue with getting the port from the user context.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging driver.c
Auto-merging gateway.c
CONFLICT (content): Merge conflict in gateway.c
Failed to merge in the changes.
Patch failed at 0001 Issue with getting the port from the user context.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

rebase refs/remotes/trunk: command returned error: 1

这把我放在一个叫什么的分支上,这个分支是什么,它是干什么用的?:

*(no branch)

然后我解决该分支的冲突。然后我检查我的 play_video 分支。我尝试制作另一个:

svn git dcommit

最后我又绕了一圈。

在我开始拔头发之前,可​​以给我一些建议吗?

非常感谢您的任何建议,

【问题讨论】:

  • 在这里遇到同样的问题...快 3 年了,没有任何建议...

标签: svn git git-svn


【解决方案1】:

没有完整的答案,但似乎可以肯定的是:

*(no branch)

意味着您最终处于DETACHED HEAD 模式,您可以在“Can I recover lost commits in a SVN repository using a local tracking git-svn branch?”的 git svn 上下文中看到该模式。
另见“Why did git detach my head?”。

所以请确保:

  • 在每个步骤中,您都没有处于分离的 HEAD(无分支)中
  • dcommit 存在于您的 SVN 存储库中的分支(而不是纯本地 Git 分支)

【讨论】:

  • 感谢您的帮助。我正在检查这个。
  • 我发现自己被困在这里,我尝试执行一堆不同的 git 命令,但最终运行 git svn dcommit 之前我能够进行任何进一步的 svn 合并。
  • @dtan:有什么问题或错误信息需要帮助吗?
  • @VonC - 不,我很久以前也遇到过这个问题,最近又遇到了。我只知道试图破译发生了什么并不好玩,但现在我至少知道当我再次遇到这个问题时该怎么做。不过谢谢
  • 这个答案是不正确的,任何时候你有一个不完整的 rebase(svn 或其他)你都会被留在一个分离的头上。我也遇到了 git merges 和随后的 'git svn rebase' 的问题。
【解决方案2】:

您是否使用 Google 说明 here 将您的 git repo 导入到 svn?使用这些说明后,我遇到了类似的错误:初始导入正常,但在某处出现问题,我无法推送后续提交。

我通过 git svn init-ing 一个新的 git repo 来跟踪我的 svn repo 解决了这个问题。

【讨论】:

    【解决方案3】:

    解决冲突后,您需要先运行git rebase --continue,然后再运行git svn dcommit

    【讨论】:

    • git rebase --continue 只是说没有什么可提交的。
    【解决方案4】:

    我遇到了类似的问题,可能是因为我在推送到 SVN 远程之前推送到了我的 git 远程,从而弄乱了我的 git 历史记录。似乎每次我尝试向 svn 提交某些内容时,git 都会尝试重播我以前的所有提交,即使它们已经存在于 svn 中,所以我只做git rebase --skip 直到我回到最新的提交,但最简单的解决方案是可能只是克隆一个新的 git svn。

    【讨论】:

    • 再考虑 2 秒后,我意识到每次推送到 svn 后,我都是从远程 git 中拉出,这又拉下错误的 git 历史记录。我对 git 远程进行了强制推送,一劳永逸地纠正了历史差异,并且 rebase 问题现在已经消失了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-04
    • 2012-07-12
    • 2011-07-16
    • 2010-09-16
    • 2018-10-13
    • 2010-11-05
    • 1970-01-01
    相关资源
    最近更新 更多