Mahi
Mahi

Reputation: 21893

Unable to rename git branch to "master", pushes to remote with incorrect name

Using this SO post as a reference, I was able to rename my master to v1 and now I want to rename my v2 branch to master. I've already changed the default branch to v1 from GitHub, but when I attempt to rename v2 to master, the local branch renames fine but for some reason it pushes v2 name to remote. Here's the command line session:

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Mahi\Documents\GitHub\EasyPlayer>git branch
  v1
* v2

C:\Users\Mahi\Documents\GitHub\EasyPlayer>git branch -m master

C:\Users\Mahi\Documents\GitHub\EasyPlayer>git branch
* master
  v1

C:\Users\Mahi\Documents\GitHub\EasyPlayer>git push origin :v2
To https://github.com/Mahi/EasyPlayer.git
 - [deleted]         v2

C:\Users\Mahi\Documents\GitHub\EasyPlayer>git push origin master
Counting objects: 39, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (39/39), 8.17 KiB | 0 bytes/s, done.
Total 39 (delta 9), reused 39 (delta 9)
To https://github.com/Mahi/EasyPlayer.git
 * [new branch]      master -> v2

C:\Users\Mahi\Documents\GitHub\EasyPlayer>

How do I properly rename my v2 branch to master?

Upvotes: 1

Views: 59

Answers (1)

VonC
VonC

Reputation: 1323973

Try and force the local/remote branch association with:

git push -u origin master:master

Your local config for that branch might still have v2 as its upstream branch. The above command-line should reset that.

Upvotes: 1

Related Questions