Git rebase失败,“您对以下文件的本地更改将被合并覆盖”。没有本地变化?


104

这是我试图将我的bugfix分支合并到我的master分支中以准备将其推向上游的笔录。自从bugfix分支创建以来,已经在上游进行了一些上游更改,现在拒绝重新设置基准。

引发错误的文件在打开时不会进行比较。没有添加,删除或重命名文件。什么都不会被忽略,没有任何事情会被追踪,暂存或暂存。我完全为失败原因而感到困惑。

我在OS X 10.6.6和git 1.7.4上

.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git rebase bug586-test master-test
First, rewinding head to replay your work on top of it...
Applying: - comiitting code related to api permissions
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
    inc/data.inc
    templates/apipermissions_tpl.inc
    templates/currencies_tpl.inc
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0001 - comiitting code related to api permissions

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



.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git status
# Not currently on any branch.
nothing to commit (working directory clean)



.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git rebase --abort
HEAD is now at 5efccf1 - comiitting code related to api permissions



.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git log -n10 --oneline
5efccf1 - comiitting code related to api permissions
a8a5ee4 Style changes for IE
cfca618 Style changes for IE
8a69de6 Style changes for IE
8946585 - comiitting code related to api permissions - fixed an html error in the currencies template
5fba0a9 Merges the 1.11b branch bugfixes and changes into trunk
ef57049 Andrew Commiting on Blakes behalf on changes he made to transfers; Also an Indue GW balance fix; debitcarupload fix for LSN
69e4313 Fixed an issue with Support From email
9058fb6 Sets the svn property svn:eol-style to LF, to enforce unix style line endings
240839e Fixes up a lot of the whitespace issues.



.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git checkout bug586-test 
Switched to branch 'bug586-test'



.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git log -n10 --oneline  
b7b1f8a Resolves #586, Postback on deposit
5fba0a9 Merges the 1.11b branch bugfixes and changes into trunk
ef57049 Andrew Commiting on Blakes behalf on changes he made to transfers; Also an Indue GW balance fix; debitcarupload fix for LSN
69e4313 Fixed an issue with Support From email
9058fb6 Sets the svn property svn:eol-style to LF, to enforce unix style line endings
240839e Fixes up a lot of the whitespace issues.
cf27b6f - bug that came up with transferring. The transfer page had a hidden field called to, which was taking precedence over cards and usercard which would throw the system out a bit
7c21a81 Fixes #603, new add transaction form, journalled.
01e6292 Removes a pile of resource forks
880c5bc - bug that came up with transferring. The transfer page had a hidden field called to, which was taking precedence over cards and usercard which would throw the system out a bit



.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git rebase master-test bug586-test
First, rewinding head to replay your work on top of it...
Applying: Resolves #586, Postback on deposit
Using index info to reconstruct a base tree...
<stdin>:52: trailing whitespace.
                'name' => 'Invoice Transfer Out', 
<stdin>:175: trailing whitespace.

warning: 2 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:
    templates/deposit_tpl.inc
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0001 Resolves #586, Postback on deposit

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



.-(/Volumes/joshua/www/txfunds)-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(joshua@Kusanagi)-
`--> git rebase --abort
HEAD is now at b7b1f8a Resolves #586, Postback on deposit

您应该将git status的内容,gitignore的内容和ls分别发布到相关目录中,以便于阅读。至少可能会有所帮助。
卡扎伊2011年

您是否有crlf设置或其他设置?Rebase不应这样创建肮脏的工作树。git status当重新设置失败时,这可能会有所帮助。它拒绝与肮脏的树木一起奔跑。在开始之前,我们知道它是干净的。这是当有状态,是造成问题的本地修改。
卡斯卡贝尔2011年

您确定git rebase的参数顺序吗?第一个参考是要重设基础的参考,而可选的第二个参考是首先要检出的参考。也许您应该交换它们。
Laurent Pireyn 2011年

Answers:


191

这与我的另一个麻烦问题是相同的答案。

我在Mac上,这种晦涩的配置更改似乎可以解决我在无暂存更改时的所有麻烦。

git config --global core.trustctime false

我认为这与Windows文件时间,Linux文件时间和Mac文件时间之间的差异有关。谁知道,如果您愿意,请随时发表评论。

更新:这篇博客文章解释了正在发生的事情。


1
谢谢!我从来没有想过这个。
Christopher Pickslay 2011年

1
克里斯,在这里也是一样-我绝对想知道是什么原因使它对我有用。
karlbecker_com 2012年

不幸的是,这对我没有用。即使Git抱怨的文件不在项目中,退出Xcode 也会有所帮助。
罕见

1
我在SuSE上使用git-svn在不同时区提交到SuSE svn服务器。无论作出什么解释,这也为我解决了问题。
乔纳森·哈特利

5
这是什么原因的解释git-tower.com/blog/make-git-rebase-safe-on-osx/#!似乎与修订的后台进程有关。
schmunk

48

关于Joshua Hogendorn的回答:在我看来,在使用git处理存储库时将Xcode保持打开状态会导致这些问题。甚至导致git提交了一些我认为已经藏匿(并且此后仍然保留)的东西,但是Xcode只是在重建基准期间将其写入了文件系统。

因此:如果您想确保安全,请在使用git处理存储库之前关闭Xcode项目,然后可能不需要core.trustctime false设置。


也许您在IDE中启用了某种“每N分钟自动保存文件”设置?不要那样做。
Mikko Rantalainen

4
我尝试过……并为我工作!在进行重新设置基准之前,请关闭xcode。浪费很多时间一无所有。谢谢 !
Nicolas Lauquin

尽管我使用的是Aptana Studio 3,但我遇到了与上述相同的错误。退出Aptana时,重新设置工作正常。几天前,我已经关闭了Aptana的git集成。要么它没有真正关闭,要么我应该重新启动Aptana。
Bill Hoag 2014年

3
在Visual Studio 2013中打开项目时,面临相同的问题。关闭项目解决了该问题。
Mohammad Dehghan 2015年

3
更一般而言,这似乎是在重新设置基准期间文件被锁定的问题。对我来说,它正在webpack --watch运行。
Marc Stober
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.