I do not want to upload my app to the wrong domain.
How can I change the git master branch on git?
-
Yes. I have created a new heroku app: heroku create myapp. But I have another app on heroku. I just want to change the git master to the new app. So that i can say git push heroku master. And the code will be oploaded to the new app not the old one.Jon– Jon2011年06月03日 12:27:51 +00:00Commented Jun 3, 2011 at 12:27
-
possible duplicate of Replace remote git repo (Heroku)lambshaanxy– lambshaanxy2014年03月05日 12:13:05 +00:00Commented Mar 5, 2014 at 12:13
9 Answers 9
If you're working on the heroku remote (default):
heroku git:remote -a [app name]
If you want to specify a different remote, use the -r argument:
heroku git:remote -a [app name] -r [remote]
EDIT: thanks to Алексей Володько For pointing it out that there's no need to delete the old remote.
3 Comments
heroku git:remote -a appname - will replace the old one just fine.Assuming your current remote is named origin then:
Delete the current remote reference with
git remote rm origin
Add the new remote
git remote add origin <URL to new heroku app>
push to new domain
git push -u origin master
The -u will set this up as tracked.
4 Comments
The -u will set this up as tracked. Thanks!View Remote URLs
> git remote -v
heroku https://git.heroku.com/###########.git (fetch) < your Heroku Remote URL
heroku https://git.heroku.com/############.git (push)
origin https://github.com/#######/#####.git (fetch) < if you use GitHub then this is your GitHub remote URL
origin https://github.com/#######/#####.git (push)
Remove Heroku remote URL
> git remote rm herokuSet new Heroku URL
> heroku git:remote -a ############
And you are done.
Comments
This worked for me:
git remote set-url heroku <repo git>
This replacement old url heroku.
You can check with:
git remote -v
Comments
If you have multiple applications on heroku and want to add changes to a particular application, run the following command : heroku git:remote -a appname and then run the following.
- git add . 2)git commit -m "changes" 3)git push heroku master
Comments
You can have as many branches you want, just as a regular git repository, but according to heroku docs, any branch other than master will be ignored.
http://devcenter.heroku.com/articles/git
Branches pushed to Heroku other than master will be ignored. If you’re working out of another branch locally, you can either merge to master before pushing, or specify that you want to push your local branch to a remote master.
This means that you can push anything you want, but you app at heroku will always point to the master branch.
But, if you question regards how to create branches and to work with git you should check this other question
3 Comments
change the git master you mean changes files, then commit and push to it? rename it? What exactly are you trying to do?Remove Heroku remote URL from git repo
> git remote rm heroku
Set new Heroku URL from git repo
> git remote add heroku ##########
Comments
here is a better answer found through Git docs.
This shows what the heroku remote is:
$ git remote get-url heroku
Found it here: https://git-scm.com/docs/git-remote Also in that document is a set-url, if you need to change it.
Comments
write in terminal if you already login with heroku from terminal..
heroku git:remote -a appname