Luke Flournoy Luke Flournoy - 18 days ago 8
Git Question

How to add a branch, created on a forked repo, to the upstream repo?

I was migrating my hotfix branch from Mercurial to Git. I used the hg-git plugin to import my hotfix branch into a new branch on my forked repo of my git project. Is there a way to add the newly created branch to the upstream repo? The branch does not currently exist on the upstream repo.

I tried to run...

git push u git@git.<name of upstream repo>.git hotfix


but got the error....

error: src refspec git@git.<name of upstream repo> does not match any
error: failed to push some refs to 'u'

Answer

You should use -u instead of u. You can try this command: git push -u origin hotfix

Note: origin is the default short name for remote. You can use git remote -v to check if your remote short name is origin or else.