我的这几次git pull --rebase发生了什么,错误"您对以下文件的本地更改将被合并覆盖"

pkt*_*yue 9 git git-rebase

我曾经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".
Run Code Online (Sandbox Code Playgroud)

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

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

很奇怪,它改为分离分支,没有任何更改的文件.

所以我放弃了它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".
Run Code Online (Sandbox Code Playgroud)

然后,我看了看git status:

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

第一次非常相似.

我再一次放弃了它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...
Run Code Online (Sandbox Code Playgroud)

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

现在日志如下所示:

* 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
Run Code Online (Sandbox Code Playgroud)

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

Nil*_*s_M 8

它可能与有关.我有同样的问题,你做了很长一段时间,这有帮助.我找不到任何关于这个原因的共识(这是一些更多的讨论).似乎某些东西正在改变文件元数据,实质​​上是重置文件的ctime,因此当依赖ctime信息时,git不会将它们识别为已更改.

链接到git文档trustctime:git-config,git-update-index