I created a branch from my master (origin) and called it TEST-101
(uppercase). I then worked on my branch and committed and pushed my changes up to origin. When I log in to Github, I can see I the branch I created.
I used git bash and checked out my local version of the branch, but I entered it in all lowercase: test-101
. I then used Git Gui and committed my changes to the branch which was typed in lower case, and when I tried to push these changes it gave me an error:
POST git-receive-pack (390618 bytes)
remote: error: failed to lock refs/heads/test-101
Pushing to ht://example/example/example/example.git
To ht://example/example/example/example.git
! [remote rejected] test-101 -> test-101 (failed to lock)
error: failed to push some refs to 'http://example/example/example/example.git'
(Please note that I have changed some private info in the error.)
I have done some reading, and it appears that my local branch being in lowercase and the remote branch being in uppercase may be causing an issue?
The following solved the problem:
git branch -m test-101 tmp_branch
git branch -m tmp_branch TEST-101
You can do the following:
git branch -m test-101 tmp_branch
git checkout tmp_branch
git merge TEST-101 // make sure your data is up to date
git branch -D TEST-101
git branch -m tmp_branch TEST-101
-m
option renames the branch, and -D
option will delete the branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With