Ondrej Peterka
Ondrej Peterka

Reputation: 3427

How to merge branches with different case on windows in GIT?

My colleague created by accident a branch named develop-client (lower case 'c') from our main branch "develop-Client" (upper case 'C'). We all work on windows. Now, how I can merge the develop-client back into develop-Client? Git in windows sees both branches as one, so when I try do "git merge --no-ff origin/develop-client" (when I am on develop-Client), it says "Already up-to-date".

Upvotes: 2

Views: 336

Answers (3)

Geeky I
Geeky I

Reputation: 751

This happened to me on my local repository. It was one commit ahead of remote. I simply renamed the files as Michael suggested: In

.git/refs/heads/<in-lower-case>

to

.git/refs/heads/<in-Capital-case>

As I had also accidentally pushed to remote, I deleted the upstream lower case branch (at Github in my case) and in my local repo, changed remotes:

.git/refs/remotes/origin/<in-lower-case>

to

.git/refs/remotes/origin/<in-Capital-case>

Upvotes: 0

Michael Wild
Michael Wild

Reputation: 26381

Either specify the hash of the HEAD commit of the branch you want to merge, or alternatively, manually rename the offending branch to a temporary name inside the .git/refs/heads directory.

Upvotes: 1

forvaidya
forvaidya

Reputation: 3315

Determine its SHA using command git rev-parse Branch_name and merge using command git merge SHA1

Upvotes: 2

Related Questions