GIT – reconnect remote branch

Sometimes it is necessary to remap a local git  branch to a remote one (reconnect remote branch). For me it was the case, because I accidentally removed all origins in a multi-origin setup. Hence I got the following error message when trying to pull without naming remote and branch, although I re-added and fetched all remotes :

fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

The solution to reconnect remote branch

The solution was as short as simple. Under git version 2.7.4 I only had to remap the remote branch by the following command:

$> git branch master-international --set-upstream-to international/master

That’s how to reconnect remote branches on bash. It can also be used to map newly created lokal branches to a remote origin an branch.

Further information about git

You can find more information and useful  tips and tricks about git on the following pages:

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.