After fresh IDE install, how to get branches from remote

My existing IDE has been installed for quite a while, and I’m thinking with all the recent changes, it might be time to start with a fresh IDE install.

I just installed the latest IDE on a different box from the existing IDE. That worked fine.

I have a bunch of dev branches that I pushed to my GitHub repo with the old IDE. My question is how to get those dev branches into the local repo of the new IDE installation.

I see that in my new IDE install, the remotes are defined like this.

$ git remote -v
origin  https://github.com/openhab/openhab2-addons.git (fetch)
origin  https://github.com/mhilbush/openhab2-addons.git (push)

Therefore, when I try to view the remote branches, all I see is this.

$ git branch -r
  origin/lolodomo-patch-1
  origin/master

So, I’m assuming a git fetch won’t get all the dev branches that I pushed using my old IDE install.

What’s the right way to get those branches into my local repo?

You can add a remote for that. Fetch the branches and create the branches:

$ git remote add mhilbush https://github.com/mhilbush/openhab2-addons.git
$ git fetch mhilbush 
remote: Enumerating objects: 337, done.
remote: Counting objects: 100% (337/337), done.
remote: Total 1226 (delta 337), reused 337 (delta 337), pack-reused 889
Receiving objects: 100% (1226/1226), 2.67 MiB | 1.67 MiB/s, done.
Resolving deltas: 100% (591/591), completed with 99 local objects.
From https://github.com/mhilbush/openhab2-addons
 * [new branch]      ambient-weather-binding -> mhilbush/ambient-weather-binding
 * [new branch]      bhyve-binding -> mhilbush/bhyve-binding
 * [new branch]      doorbird-binding -> mhilbush/doorbird-binding
 * [new branch]      master     -> mhilbush/master
 * [new branch]      sharptv-binding -> mhilbush/sharptv-binding
 * [new branch]      squeezebox-callback-url -> mhilbush/squeezebox-callback-url
 * [new branch]      sunsetwx-binding -> mhilbush/sunsetwx-binding
 * [new branch]      weather-company-binding -> mhilbush/weather-company-binding
 * [new branch]      zoneminder-checkpoint-2 -> mhilbush/zoneminder-checkpoint-2
$ git checkout -b weather-company-binding mhilbush/weather-company-binding
Branch weather-company-binding set up to track remote branch weather-company-binding from mhilbush by rebasing.
Switched to a new branch 'weather-company-binding'
$ git checkout -b sharptv-binding mhilbush/sharptv-binding
Branch sharptv-binding set up to track remote branch sharptv-binding from mhilbush by rebasing.
Switched to a new branch 'sharptv-binding'
$ git branch -v
  master                  1838c95 [bluetooth.ruuvitag] New binding for Ruuvi Tag Bluetooth Environmental Sensor (#4913)
* sharptv-binding cd3ee31 Update to 2.5
  weather-company-binding 1dc946c Initial contribution
1 Like

That was too easy. :smile: Thanks!!

1 Like