Git push current branch to a remote with Heroku
Posted
by cmaughan
on Stack Overflow
See other posts from Stack Overflow
or by cmaughan
Published on 2010-03-08T12:32:44Z
Indexed on
2010/03/08
12:36 UTC
Read the original article
Hit count: 424
I'm trying to create a staging branch on Heroku, but there's something I don't quite get.
Assuming I've already created a heroku app and setup the remote to point to staging-remote, If I do:
git checkout -b staging staging-remote/master
I get a local branch called 'staging' which tracks staging-remote/master - or that's what I thought....
But:
git remote show staging-remote
Gives me this:
remote staging
Fetch URL: [email protected]:myappname.git
Push URL: [email protected]:myappname.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
staging-remote merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
As you can see, the pull looks reasonable, but the default push does not. It implies that if I do:
git push staging-remote
I'm going to push my local master branch up to the staging branch. But that's not what I want.... Basically, I want to merge updates into my staging branch, then easily push it to heroku without having to specify the branch like so:
git push staging-remote mybranch:master
The above isn't hard to do, but I want to avoid accidentally doing the previous push and pushing the wrong branch... This is doubly important for the production branch I'd like to create!
I've tried messing with git config, but haven't figured out how to get this right yet...
© Stack Overflow or respective owner