Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle case sensitive branches on Git over Windows

A project I'm working on have two branches named as: Feature/something and feature/something

I need to work in both for a while

On Windows I'm facing errors using GitBash and AndroidStudio.

After doing checkout of the Feature/something, on pull or fetch I receive the following error:

git fetch
error: cannot lock ref 'refs/remotes/origin/Feature/something': is at 0dd1cd393b4af49d2ad90a22c813b607078a7e0c but expected 44b50f539d55835a9e2e1f22c406561bf4a6dc95
From http://myurl/myproject
 ! 44b50f5..600f329  Feature/something -> origin/Feature/something  (unable to update local ref)

I was working without problems on the feature/something branch.

On cloning again and making checkout of the Feature/something branch first I can work fine with that branch but the problems occur with the feature/something branch.

Any idea on how to work on both branches in the same local repo?

like image 924
João Oliveira Avatar asked Dec 05 '25 03:12

João Oliveira


1 Answers

you could use custom push/fetch refspecs to map them to different branches. So, you should have something like:

[remote "origin"]
  ...
  fetch = refs/heads/feature/something:refs/remotes/origin/feature-something-l
  fetch = refs/heads/Feature/something:refs/remotes/origin/feature-something-u
  fetch = refs/heads/*:refs/remotes/origin/*

...and some corresponding specs for pushing

like image 193
max630 Avatar answered Dec 07 '25 18:12

max630



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!