2

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?

  • 1
    How did you create these branches? I've tried doing something similar in a sandbox git repo, but I keep getting the exact error message I was expecting: `fatal: A branch named 'Feature/something' already exists.` – Robin James Kerrison Sep 26 '16 at 15:37
  • 2
    I didn't create them. I believe they were created from some Linux distro or Mac. – João Oliveira Sep 26 '16 at 17:16
  • I believe this answer may be useful for you: http://stackoverflow.com/a/12069878/3183912 – Trinity Sep 28 '16 at 17:28
  • Yes, this answer will help me in the future. However I can't delete one of the branches right now, so I'm looking for a way to work with the current scenery – João Oliveira Oct 04 '16 at 13:47

1 Answers1

0

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

max630
  • 7,348
  • 2
  • 24
  • 49