Git Branch folder naming issues - Azure Devops

I've created several branches in azure devops these were:

  • main
  • dev
  • dev/Task-73-GetAllPendingStorageJobs
  • Dev/Task-74-DatabaseSessionState

The dev/feature-2 branch was created to work on a specific feature in it, before merging it to dev (and then later to main).

You can use / to create a folder like structure for your branches. Actually folders doesn't exists in git, but many UI clients treat the slash as directory seperator. In most console git clients you will just see the whole branch name without any folder like view.

Now when I tried to pull the dev branch in Visual Studio it didn't work and the git log window in VS showed this error:

From https://dev.azure.com/XX/YY/_git/ZZ
 = [up to date]      master     -> origin/master
 = [up to date]      Dev/Task-73-GetAllPendingStorageJobs -> origin/Dev/Task-73-GetAllPendingStorageJobs
 = [up to date]      Dev/Task-74-DatabaseSessionState -> origin/Dev/Task-74-DatabaseSessionState
cannot lock ref 'refs/remotes/origin/dev': there is a non-empty directory '.git/refs/remotes/origin/dev' blocking reference 'refs/remotes/origin/dev'
 ! [new branch]      dev        -> origin/dev  (unable to update local ref)
Pull operation failed.

This is because all branches with dev/ conflicted with the dev branch on the VS git client. Maybe other clients handle this differently, because for the azure devopps UI the branch naming wasn't an issue.

To fix this, I just renamed dev branch to develop in devops.