9

我曾经git pull --rebase提取最新的代码,而我有一个提交是远程来源的负责人。但是我第一次尝试两次时出错,但在第三次时,它运行良好。

第一次:

remote: Counting objects: 165, done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 111 (delta 77), reused 84 (delta 50)
Receiving objects: 100% (111/111), 18.37 KiB, done.
Resolving deltas: 100% (77/77), completed with 45 local objects.
From github.com:gumichina/crosskaiser-native
   e39c920..0491ecf  master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: complete friend list
Using index info to reconstruct a base tree...
M   application/Resources/CrossKaiser.ccbresourcelog
<stdin>:62: trailing whitespace.

<stdin>:100: trailing whitespace.

<stdin>:190: new blank line at EOF.
+
warning: 3 lines add whitespace errors.
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
    application/Classes/CoverLayer/CoverLayer.cpp
    application/Classes/Friend/FriendList.cpp
    application/Classes/Friend/FriendList.h
    application/Classes/Friend/FriendListItem.h
    application/Classes/Friend/FriendListScene.cpp
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0001 complete friend list
The copy of the patch that failed is found in:
   /Users/tangyue/project/crosskaiser-native/.git/rebase-apply/patch

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".

然后我输入git status,如下图所示:

# Not currently on any branch.
# You are currently rebasing.
#   (all conflicts fixed: run "git rebase --continue")
#
nothing to commit, working directory clean

奇怪的是它变成了一个分离分支,并且没有任何更改的文件

所以我用git rebase --abort.

第二次:

First, rewinding head to replay your work on top of it...
Applying: complete friend list
Using index info to reconstruct a base tree...
M   application/Resources/CrossKaiser.ccbresourcelog
<stdin>:62: trailing whitespace.

<stdin>:100: trailing whitespace.

<stdin>:190: new blank line at EOF.
+
warning: 3 lines add whitespace errors.
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
    application/Classes/Friend/FriendListItem.cpp
    application/Classes/Friend/FriendListScene.cpp
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0001 complete friend list
The copy of the patch that failed is found in:
   /Users/tangyue/project/crosskaiser-native/.git/rebase-apply/patch

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".

然后,我看了看git status

# Not currently on any branch.
# You are currently rebasing.
#   (all conflicts fixed: run "git rebase --continue")
#
nothing to commit, working directory clean

这和第一次非常相似。

我再次中止了它git rebase --abort

第三次:

First, rewinding head to replay your work on top of it...
Applying: complete friend list
Using index info to reconstruct a base tree...
M   application/Resources/CrossKaiser.ccbresourcelog
<stdin>:62: trailing whitespace.

<stdin>:100: trailing whitespace.

<stdin>:190: new blank line at EOF.
+
warning: 3 lines add whitespace errors.
Falling back to patching base and 3-way merge...

这一次,它运行良好,没有错误。

现在日志如下所示:

* 25f45f8 (HEAD, master) complete friend list
* 0491ecf (origin/master, origin/HEAD) add need_level to stage
* 8eb488e modify deck manager
* 1deef55 add status bar for sell scene
* 46f57b5 manage dialog&menu button priority
* 491d7e6 modify card template
* 9d09b34 add stamina dialog
* e39c920 complete TextInput
* a60d1b3 fix the name of template

谁能告诉我,在所有操作过程中发生了什么?为什么我可以git pull --rebase在两次错误后正确?

4

1 回答 1

8

可能与有关。我和你一样的问题很久了,这有帮助。不过,我无法就其原因找到任何共识(这里有一些更多的讨论)。似乎有些东西正在改变文件元数据,本质上是重置文件的 ctime,因此 git 在依赖 ctime 信息时不会将它们识别为已更改。

git 文档的链接trustctimegit-config , git-update-index

于 2013-02-28T15:21:21.110 回答