更改大小写的情况下,但GIT不会忘记旧版本 [英] Changed case of filename but GIT won't forget the old version

查看:150
本文介绍了更改大小写的情况下,但GIT不会忘记旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于将应用升级为PSR-0 complient(大写类文件名),我已将类更改为具有大写文件名。即。 users.php 已成为 Users.php 。这是行得通的,git已经注意到了这些变化并推送到远程仓库。

我的问题是如果我现在更改 Users的内容。 php 。旧的 users.php 和新的 Users.php 都显示为要更改的文件。



如何让git忘记文件的小写版本?



注意。在你的Git仓库中如果有两个文件Users.php,users.php

/ p>


  • 如果您不想使用users.php文件,则可以使用以下命令从git存储库中删除该文件 git rm文件名

  • 要将已经添加/初始化到您的存储库的单个文件解压缩,即停止跟踪文件但不会从系统中删除它: git rm --cached文件名


Due to upgrading an app to be PSR-0 complient (uppercase class file names) I have changed classes to have uppercase filename. ie. users.php has become Users.php. That's worked fine and git has noticed the changes and pushed to the remote repo.

My problem is that if I now change the contents of Users.php at all. Both the old users.php and new Users.php appear as changed files to be staged.

How do I get git to forget about the lowercase version of the file?

Note. I'm using osx which ignores casing.

解决方案

In your Git repository if have two files Users.php, users.php

  • if you donot want users.php file you can remove that file from your git repository by using the following command git rm filename
  • To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm --cached filename

这篇关于更改大小写的情况下,但GIT不会忘记旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆