0

Whenever I tried git push, it returns the following

$git push
fatal: The upstream branch of your current branch does not match
the name of your current branch. 

To push to the upstream branch
on the remote, use
git push origin HEAD:5.4
To push to the branch of the same name on the remote, use
git push origin 5.5

And when I checked the status:

$git status
On branch 0.2
Your branch is up to date with 'origin/5.4'.

How do I rename 5.4 to master 'origin/master'?

  • 1
    Possible duplicate of [Rename master branch for both local and remote Git repositories](https://stackoverflow.com/questions/1526794/rename-master-branch-for-both-local-and-remote-git-repositories) – YoannFleuryDev Jun 22 '18 at 10:05

1 Answers1

0

You are getting this error because you are using the simple value for push.default. One option is to change the push.default (e.g. to upstream), but renaming your local branch is simpler in the sense that you won't have the same thing with different names on the local and the remote side.

To rename from 5.4 to 5.5, do for example:

git branch -m 5.4 5.5
Matthieu Moy
  • 15,151
  • 5
  • 38
  • 65
  • I'd suggest to rename the branch: `git branch -m 5.4 5.5`; that way the reflog history is not lost. – j6t Jun 22 '18 at 11:41
  • Oops, you're absolutely right. My "There's no renaming of branches" was just my ignorance. I'll edit to fix that. – Matthieu Moy Jun 22 '18 at 15:42