如何更改cygwin下git中的文件大小写? [英] How to change case of a file in git under cygwin?

查看:130
本文介绍了如何更改cygwin下git中的文件大小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们工作在混合式大小写敏感/不敏感的环境(cywgin / linux),今天有人通过重命名文件,将S更改为s,在我们的工作流程中造成了一场小破坏。这导致各分支机构出现各种有趣的合并问题,而且相当诚实,没有人完全确定发生了什么。



什么是最合适的方法来改变套管一个git下的文件为cygwin?我必须强调,我们的 是区分大小写的,通常这样做是正确的 - 如果不是那样的话。

考虑了几分钟,看起来很可能 git-mv 会做你需要的。我确信它会尝试重命名(这可能是不区分大小写的操作系统上的禁用操作),然后将重命名添加到索引。这应该基于参数,而不是实际的文件 - 我在builtin-mv.c中看到 rename_cache_entry_at(pos,dst);



我不确定这是否是您要求的一部分,但对于您的分支混乱,您可能需要采取以下一般方法:




  • 将重命名修复提交给所有最下方的分支。这些可能是主题和维护分支 - 合并到其他分支中的分支,但从未将分支合并到它们中。

  • 根据正常的工作流合并这些分支,修复可能导致的任何冲突从重命名。

  • 鼓励大家尽快提出,以防万一问题有办法进一步传播。例如,某人可以使用重命名的文件然后 pull,并以错误的方式修复重命名冲突,从而导致在推/拉时重新创建问题的状态。


We work in a mixed case sensitive/insensitive environment (cywgin/linux), and today someone created a small havoc in our workflow by renaming a file, changing an S to an s. This caused all sorts of interesting merge issues across branches, and to be quite honest no-one's entirely sure of what happened.

What is the most appropriate way to change casing of a file under git for cygwin? I must stress that we are case sensitive and normally do this right - if it wasn't for that S.

解决方案

Having thought about it a couple minutes, it seems very likely git-mv would do what you need to. I'm fairly sure that it will attempt the rename (which might be a no-op on a a case-insensitive OS) then add the rename to the index. This should be based on the arguments, not on the actual file - I see rename_cache_entry_at(pos, dst); in builtin-mv.c.

I'm not sure if this is part of what you're asking or not, but with respect to your branch chaos, here's the general approach you probably want to take:

  • Commit the rename fix to all of your "farthest downward" branches. These are probably topic and maintenance branches - the ones that are merged into other branches, but never have branches merged to them
  • Merge these branches as per your normal workflow, fixing any conflicts that may result from the rename.
  • Encourage everyone to pull soon, just in case the issue has a way to propagate further. For example, someone could work on the renamed file, then pull, and fix the rename conflict the wrong way, resulting in a state which would recreate the problem when pushed/pulled.

这篇关于如何更改cygwin下git中的文件大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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