代码之家  ›  专栏  ›  技术社区  ›  Huxi

永远不会结束Git的故事-我在这里做错了什么?

  •  2
  • Huxi  · 技术社区  · 15 年前

    我想让本地Git存储库与远程Git和SVN存储库同步。

    我执行的步骤如下:

    > git push
    Everything up-to-date

    > git pull
    Already up-to-date.

    好吧,到目前为止,我的远程git repos似乎还不错。

    > git svn rebase
    First, rewinding head to replay your work on top of it...
    Applying: Fixing some javadoc problems.
    Using index info to reconstruct a base tree...
    <stdin>:13: trailing whitespace.
    \t
    <stdin>:21: trailing whitespace.
    \t\t\t\t<configuration>
    <stdin>:22: trailing whitespace.
    \t\t\t\t\t<links>
    <stdin>:23: trailing whitespace.
    \t\t\t\t\t\t<link>http://java.sun.com/javase/6/docs/api/</link>
    <stdin>:24: trailing whitespace.
    \t\t\t\t\t</links>
    warning: squelched 1 whitespace error
    warning: 6 lines add whitespace errors.
    Falling back to patching base and 3-way merge...
    Auto-merging lilith-parent/pom.xml
    为了清晰起见,我用\t替换了制表符。

    这是我之前已经做过的合并…
    我现在有了一个新的本地版本。

    > git svn dcommit
    [commits the new version to SVN... again...]

    现在master和trunk都在本地存储库的头上。

    >Git推
    To ssh://huxhorn@lilith.git.sourceforge.net/gitroot/lilith/lilith
    ! [rejected] master -> master (non-fast forward)
    error: failed to push some refs to 'ssh://huxhorn@lilith.git.sourceforge.net/gitroot/lilith/lilith'

    这意味着,阿法克,我必须先执行一个拉。苏欧…

    >GIT拉力
    Already uptodate!
    Merge made by recursive.

    这让我回到了最初…:(冲洗并重复。

    我觉得我错过了一些非常重要的要点。有人能给我解释一下吗?

    3 回复  |  直到 15 年前
        1
  •  4
  •   P Shved    15 年前

    一个分支不能通过 git-svn 和Git Via push / pull .你应该把这两个分支分开 git rebase 在本地同步的分支上,当您希望在这些分支之间传输提交时

        2
  •  4
  •   Community CDub    8 年前

    最大的线索是推送中的错误:

    ! [rejected] master -> master (non-fast forward)
    

    这意味着你是颠覆分支,而你的远程Git主分支不同意某些事情。一些变更被推/提交给了另一个不在的变更。起火 gitk --all 它应该给你一个线索,告诉你哪里出了问题——在历史上寻找“叉子”。小心树枝 [origin/master] , [master] [trunk] . 它的起源可能和你现在的主人不一样。- git svn rebase 可能导致这种情况。

    通常,如果您是通过svn和git提交的,那么最好保持git主分支与Subversion相同,并在git中的另一个分支上工作。见 this other SO question about working with git and subversion .

        3
  •  1
  •   sunny256    15 年前

    您可能还想查看日志 Best branching practices with git-svn 其中有一些与此相关的有用提示。

    如果要清除空白警告,请执行

    $ git config --global apply.whitespace nowarn