Alex
Alex

Reputation: 41

Attempted to deploy to firebase on github branch

I have two branches my github repository https://github.com/sodewumi/EnTrack/tree/master. The master works currently with firebase https://entrack.firebaseapp.com/

I'm trying to play with the code on my branch to update certain features branch: geofire_map

and I wanted to deploy the branch on a separate firebase database. When I am in the geofire_map branch I type in

firebase deploy

But when I do this, firebase updates the entrack.firebaseapp website with the code on my branch.

Can you have two separate firebase deploys for different branches within the same repo?

Upvotes: 4

Views: 2274

Answers (2)

Luan Barbosa
Luan Barbosa

Reputation: 462

You can do this by using the command firebase use <appAlias>. Automatically, when you do firebase init the file .firebaserc will be generated with an alias (that you can change by creating new aliases).

Here is the Firebase documentation for this: https://firebase.google.com/docs/cli/#adding_a_project_alias

Follow these steps every time you need to deploy to a different branch:

  • Checkout to the branch
  • firebase use <project_alias>

Now all actions done with Firebase command will be to this project.

Upvotes: 2

Frank van Puffelen
Frank van Puffelen

Reputation: 598817

You can, but it will require some juggling.

Firebase keeps track of the Firebase application that a directory maps to in a file called firebase.json in that directory. So you can delete that file and run firebase init again to create a new one after switching branches. Then you can commit the firebase.json to each branch and things should work automatically from there on.

Alternatively you might want to consider keeping each branch in a separate directory.

Upvotes: 1

Related Questions