首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >git状态显示重命名,但不正确

git状态显示重命名,但不正确
EN

Stack Overflow用户
提问于 2014-10-09 08:01:15
回答 1查看 4.3K关注 0票数 5

我使用Rails进行开发。我有一个名为cpc_admin_controller.rb的控制器--完整路径是app/controllers/cpc_admin_controller.rb,助手名为admin_helper.rb --完整路径是app/helpers/admin_helper.rb。然后,我将一个方法从admin_helper.rb移到cpc_admin_controller.rb,并保存,使用git提交。

但是git显示的消息如下

代码语言:javascript
复制
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   renamed:    app/helpers/admin_helper.rb ->    app/controllers/cpc_admin_controller.rb
#   modified:   app/helpers/admin_helper.rb

我认为它应该显示两个像这样修改的,而不是重命名的

代码语言:javascript
复制
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   app/controllers/cpc_admin_controller.rb
#   modified:   app/helpers/admin_helper.rb

有人能帮我,告诉我为什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-09 08:10:21

这条线所示

Git不关心单个文件或重命名,它跟踪整棵树。 它所显示的重命名只是基于这两个文件的内容的最佳猜测。

Git状态执行使用启发式执行重命名检测。

但是,一旦提交,您将看到这两个文件是分开的。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26273245

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档