SourceTree Errors with Gitflow

Occasionally when pulling we recieve the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin

From https://github.com/pdhiscc/conxus-web

* [new branch] feature/NET-22_Client_compliance_reporting -> origin/feature/NET-22_Client_compliance_reporting

error: Ref refs/remotes/origin/feature/NET-59 is at 1ce1dab2397ab550981a5304a8104c86e384f1b9 but expected 34ae75a0a9e6a452c8cc5939c34828ddfa7392ea

! 34ae75a..1ce1dab feature/NET-59 -> origin/feature/NET-59 (unable to update local ref)

Upon examination of the remote we see two feature branches for NET-59, one with uppercase Feature and another with lowercase feature.

We have no idea how or why this is occuring as the team is using the Git Flow exclusively, all from windows boxes. Recloning the repo seems to temporarily solve the issue, but we've had to do it enough times now that we are worried it could cause larger issues.

Our repo is on github but we are open to moving it to bitbucket if that will help.

Ideas?

2 answers

The problem here is that Windows is case-insensitive, while Git and Linux are case-sensitive.

From manojlds on StackOverflow: "Branches are just pointers to a commit. These pointers are just files." Since filenames are case-insensitive on Windows, both of the branches you have (feature/* and Feature/*) are trying to update the same pointer file, which is bad.

To fix, you should delete the incorrectly-cased branch from the remote, and review your developers' gitflow settings to make sure none of them accidentally set their feature prefix with a capital F.

If there are unique commits in the branch that needs deleted, tag it first, and you can merge or cherry-pick into the correct branch once things are fixed.

Instruct your users to either

  • always use only lowercase when creating branches locally or
  • create their branches on the web interface and then pull them to their clones,

to avoid this kind of problem in the future.

Sounds simple enough! Thanks ;)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Jodi LeBlanc
Posted Thursday in Off-topic

Friday Fun: How do you recharge your batteries after a busy week?

Happy Friday – Fun Day! I don’t know about you, but I have been giving everything I’ve got this week (and most weeks) and come Friday I look for unique ways to recharge my batteries - rest, relax, a...

218 views 21 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you