Adam Bronfin
Adam Bronfin

Reputation: 1269

Git - Push current Heroku repo to a remote github repo

I have a project set up with a heroku Git repository and after making some new changes on a new branch I want to push this branch and the diff between my last Heroku commit to the Github repo.

How would I go about doing this so I can engage in a work flow of pushing to Heroku and to Github when specified?

Upvotes: 1

Views: 87

Answers (1)

ffflabs
ffflabs

Reputation: 17481

As a general solution, you add github as an additional repo to your project. At this point heroku is your origin repo, so let's say github is your alternate repo.

You create a new repo in your github account, let's say

[email protected]:AdamBronfin/myproject.git

Then you add it to your working copy

git remote add alternate [email protected]:AdamBronfin/myproject.git

Then, whenever you want to sync from heroku to github, you do

git pull origin master
git push alternate master

in this example I used the master branch, but you can do the same with the other branches. As per pushing the diff from your latest commit, that's a bit more specific and you'll have to try for yourself.

Upvotes: 2

Related Questions