无法继续进行git rebase操作

5
以下是我的尝试,希望有人能花点时间看看并提出建议。谢谢!

编辑:我相信我已经回答了自己的问题:https://dev59.com/smnWa4cB1Zd3GeqPy0Yr#12760672

  • Clone my repo

    $ git clone leoj3n/roots
    Cloning into 'roots'...
    remote: Counting objects: 3177, done.
    remote: Compressing objects: 100% (1362/1362), done.
    remote: Total 3177 (delta 2117), reused 2761 (delta 1792)
    Receiving objects: 100% (3177/3177), 1.40 MiB | 609 KiB/s, done.
    Resolving deltas: 100% (2117/2117), done.
    Checking out files: 100% (146/146), done.
    
  • Change directory

    $ cd roots
    
  • Check status

    roots(parent) $ git status
    # On branch parent
    nothing to commit (working directory clean)
    
  • Add upstream

    roots(parent) $ git remote add upstream retlehs
    roots(parent) $ git remote
    origin
    upstream
    
  • Fetch

    roots(parent) $ git fetch --all
    Fetching origin
    Fetching upstream
    remote: Counting objects: 70, done.
    remote: Compressing objects: 100% (30/30), done.
    remote: Total 56 (delta 28), reused 51 (delta 23)
    Unpacking objects: 100% (56/56), done.
    From git://github.com/retlehs/roots
     * [new branch]      classic    -> upstream/classic
     * [new branch]      grunt      -> upstream/grunt
     * [new branch]      improve_sidebar_config -> upstream/improve_sidebar_config
     * [new branch]      master     -> upstream/master
     * [new branch]      vcard_refactor -> upstream/vcard_refactor
     * [new tag]         5.1.0      -> 5.1.0
     * [new tag]         5.2.0      -> 5.2.0
     * [new tag]         6.0.0      -> 6.0.0
     * [new tag]         6.1.0      -> 6.1.0
    
  • Rebase parent onto upstream/master

    roots(parent) $ git rebase -i upstream/master
    
    <<<<<< BEGIN WHAT I HAD IN vi >>>>>>
    pick 4904103 improved url cleaning for child themes
    s 986e6de added some is_child_theme() checks
    s 2860aee urls now look like /child/css/*
    s 4282ee0 Look for files in child, then in roots
    p bf9a89a Now using Theme Hook Alliance
    f 56d1211 Added THA utility script
    f 7702269 Added missing hooks
    f 14204d8 Support for multisite
    f aca4577 No more multisite rewrites
    f 8144b83 Revert some changes
    pick fbf1dec Added filter to disable sidebars
    pick 9b77e72 Added font-awesome
    f 161864d Remove test code
    <<<<<< END WHAT I HAD IN vi >>>>>>
    

    Then I get this error:

    error: could not apply 4904103... improved url cleaning for child themes
    
    When you have resolved this problem, run "git rebase --continue".
    If you prefer to skip this patch, run "git rebase --skip" instead.
    To check out the original branch and stop rebasing, run "git rebase --abort".
    Could not apply 4904103... improved url cleaning for child themes
    
  • Resolve the conflicts

    roots(parent|REBASE-i) $ git mergetool
    merge tool candidates: opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse ecmerge p4merge araxis bc3 emerge vimdiff
    Merging:
    lib/config.php
    
    Normal merge conflict for 'lib/config.php':
      {local}: modified file
      {remote}: modified file
    Hit return to start merge resolution tool (opendiff): 
    2012-10-06 05:10:11.363 FileMerge[22088:707] Unable to load platform at path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
    2012-10-06 05:10:11.364 FileMerge[22088:707] Unable to load platform at path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform
    

    Note I get some errors running Opendiff.

  • Done resolving conflicts, so continue

    roots(parent|REBASE-i) $ git rebase --continue
    You must edit all merge conflicts and then
    mark them as resolved using git add
    
  • Huh? Check status:

    roots(parent|REBASE-i) $ git status
    # Not currently on any branch.
    # You are currently rebasing.
    #   (all conflicts fixed: run "git rebase --continue")
    #
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #   modified:   lib/config.php
    #   modified:   lib/htaccess.php
    #
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #   lib/config.php.orig
    
  • Remove merge backup file

    roots(parent|REBASE-i) $ rm lib/config.php.orig 
    
    roots(parent|REBASE-i) $ git status
    # Not currently on any branch.
    # You are currently rebasing.
    #   (all conflicts fixed: run "git rebase --continue")
    #
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #   modified:   lib/config.php
    #   modified:   lib/htaccess.php
    #
    
  • Continue rebase

    roots(parent|REBASE-i) $ git rebase --continue
    You must edit all merge conflicts and then
    mark them as resolved using git add
    
  • Hmm, try adding everything

    roots(parent|REBASE-i) $ git add -A
    
    roots(parent|REBASE-i) $ git rebase --continue
    You must edit all merge conflicts and then
    mark them as resolved using git add
    
这是我放弃并提出这个S.O.问题的时候。
以下是更多信息:
roots(parent|REBASE-i) $ git diff-files --ignore-submodules
:100644 100644 f65cf1dc4573c51e54d7cf3772d06caf96726616 0000000000000000000000000000000000000000 assets/js/vendor/jquery-1.8.2.min.js

我认为这可能与合并工具opendiff有关 - 请注意上面的错误。

roots(parent|REBASE-i) $ git config --list
user.name=xxxxxx
user.email=xxxxxx
credential.helper=osxkeychain
alias.pu=!git fetch origin -v; git fetch upstream -v; git merge upstream/master
alias.co=checkout
alias.ci=commit
alias.rb=rebase
color.ui=auto
core.excludesfile=/Users/xxxxxx/.gitignore_global
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=false
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@github.com:leoj3n/roots.git
branch.parent.remote=origin
branch.parent.merge=refs/heads/parent
remote.upstream.url=git://github.com/retlehs/roots.git
remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*

令人惊讶的是,我能够在我的Windows机器上使用TortoiseMerge进行变基操作。


2
从您得到的状态消息中,我假设您至少正在运行git 1.7.12,在这种情况下,“您必须编辑所有合并冲突,然后[..]”错误是在git diff-files --quiet --ignore-submodules以非零退出代码退出时输出的。您可以运行git diff-files --ignore-submodules并将输出粘贴到您的问题中吗? - Mark Longair
请看结尾处的编辑。 - leoj
非常奇怪 - 我不确定为什么 assets/js/vendor/jquery-1.8.2.min.js 出现在 git diff-files 输出中,但没有出现在 git status 中。该文件目前是否存在于工作树中? - Mark Longair
1
我怀疑它们实际上并不相关。如果你只是想解决这个问题,我猜测如果你执行以下操作:git add assets/js/vendor/jquery-1.8.2.min.js 然后 git rebase --continue,它应该可以解决。然而,这看起来像是非常奇怪的行为,可能值得向 git 邮件列表报告。 - Mark Longair
你是否设置了一些意想不到的配置选项?如果你包含 git config --list 的输出(已删除其中的个人或敏感信息),那可能会有所帮助。 - Mark Longair
显示剩余2条评论
1个回答

3

看起来问题是由于文件时间不正确引起的。这个仓库在网络驱动器上,并且被Windows和Mac都访问/修改...

我所需要做的,似乎只是改变一个配置项...

git config --global core.trustctime false

该解决方案可在 https://dev59.com/MFTTa4cB1Zd3GeqPrEw4#5255700 找到。

2
谁能想到呢。很高兴你找到了答案。 - Ikke

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接