bash Git远程两个分支同名不同大小写

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31814663/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:23:56  来源:igfitidea点击:

Git remote two branches same name different case

gitbash

提问by Kisbys

origin/joetest
origin/JoeTest

I have a problem I have two remote branches in git which are the same name with different case.

我有一个问题,我在 git 中有两个远程分支,它们的名称不同,但大小写不同。

I can't work out what todo in visual studio online I can see the differences but it can't merge them because of conflicts.

我无法确定在线 Visual Studio 中的待办事项我可以看到差异,但由于冲突而无法合并它们。

The git tools in visual studio and git bash can't tell the difference between the two cases and the people working on them the syncing is now off with some commits on one and some on the other.

Visual Studio 和 git bash 中的 git 工具无法区分这两种情况和处理它们的人员之间的区别,同步现在已经关闭,一些提交在一个上,一些在另一个上。

any thoughts on what the heck we can do?

关于我们能做什么的任何想法?

thanks

谢谢

采纳答案by poke

Clone the repository on an operating system with a case-sensitive file system, e.g. Linux, then rename one of the branches, push it, and delete the old branch:

在具有区分大小写的文件系统(例如 Linux)的操作系统上克隆存储库,然后重命名其中一个分支,推送它,然后删除旧分支:

git clone <url> repo
cd repo
git checkout -b joetest2 origin/JoeTest
git push origin joetest2:joetest2
git push origin :JoeTest

As for why Git is having issues with branch names with different case, see this related question.

至于为什么 Git 在不同大小写的分支名称上有问题,请参阅此相关问题

回答by bradgonesurfing

There is some magic I just discovered and it works under windows. I had two directories

我刚刚发现了一些魔法,它在 Windows 下工作。我有两个目录

XUnitRemoteand XunitRemote

XUnitRemoteXunitRemote

I did the following

我做了以下

 git mv XunitRemote XUnitRemote.todo
 git mv XUnitRemote.todo XUnitRemote

and it just worked

它只是工作