我没有快速的测试方法,但类似:
git checkout master
git branch -m temp
git checkout --track origin/Master
git push origin HEAD:renamed
git push origin :Master
git checkout temp
git branch -D Master
git branch -m master
应该这样做。
在你的 Mac 上制作一个区分大小写的磁盘映像,克隆到它,然后在那里进行修复可能会更容易。
编辑:我做了一个快速测试,它如上所述工作。可能有一些捷径;我会把它留给评论者退出。这是一个成绩单(#
内联评论):
$ git remote update # update repository
Fetching origin
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (2/2), done.
From /Volumes/Disk Image/remote
* [new branch] Master -> origin/Master
$ git branch -a # note bad name 'Master'
* master
remotes/origin/HEAD -> origin/master
remotes/origin/Master
remotes/origin/master
$ git checkout master
Already on 'master'
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
$ git branch -m temp # rename 'master' for a moment
$ git checkout --track origin/Master # checkout the bad branch
Branch Master set up to track remote branch Master from origin.
Switched to a new branch 'Master'
$ git push origin HEAD:renamed # push it with a different name
Total 0 (delta 0), reused 0 (delta 0)
To /Volumes/Disk Image/remote
* [new branch] HEAD -> renamed
$ git push origin :Master # delete bad branch on remote
To /Volumes/Disk Image/remote
- [deleted] Master
$ git checkout temp # checkout renamed 'master'
Switched to branch 'temp'
$ git branch -D Master # delete bad local branch
Deleted branch Master (was 5343242).
$ git branch -m master # change 'master' name back
$ git branch -a # presto!
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/renamed