Created
May 11, 2011 08:55
-
-
Save seangeo/966139 to your computer and use it in GitHub Desktop.
Create a local tracking branch of your heroku deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assuming you have remote branch called heroku/master, start by creating a local tracking branch | |
called heroku. | |
> git checkout -b heroku -t heroku/master | |
This will checkout the last revision you deployed to Heroku. | |
Now tell git to push the heroku branch to heroku/master | |
> git config remote.heroku.push heroku:master | |
You can then make changes on this branch independently of your master | |
and when you're ready to deploy to heroku just do this on your local | |
heroku branch | |
> git commit -m "Some minor bug fixing" | |
> git push heroku heroku:master | |
... Will deploy ... | |
You can work on features on master: | |
> git checkout master | |
> # hack away | |
> git commit -a -m "My awesome new feature" | |
To deploy to Heroku | |
> git checkout heroku | |
> git merge master | |
> git push heroku heroku:master | |
You can use the same technique to have multiple heroku apps for the one codebase, | |
e.g. a staging and production version. |
Since you mapped the branches in your git.config call (line 10) I don't think you need the branch mapping in your push (line 30), right? See https://gist.github.com/2002048
This is an amazing fix if your local master branch is corrupted after merge conflict, and to get a fresh replica of the working remote. Thanks!
Thanks a lot! I was thinking along these lines just initially started on Heroku today and wanted a separate heroku branch.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for posting this! I working on new features for a production application and wish to deploy without merging for master so this helps me out a lot!