Friday, March 6, 2015

Deploy heroku app from a Git subfolder

I have an existing Git repo on Github, with an example app inside the sub-folder. That looks like

dj-mongo-reader
├── dist
├── dj_mongo_reader.egg-info
├── djmongoreader
│   ├── static
│   │   └── dj-mongo-reader
│   │       └── js
│   └── templates
│       └── dj-mongo-reader
└── example
    └── *****sampleapp****
        ├── sampleapp
        └── templates
            └── dj-mongo-reader

The sampleapp folder under example is the app which I wanna push to Heroku.

Here's how to archive the goal:
1, enter git root folder
cd dj-mongo-reader 

2, register app on Hoerku (add remote url)
heroku git:remote -a dj-mongo-reader

3, push sub folder to heroku
git subtree push --prefix example/sampleapp heroku master


4, to force push sub folder to heroku
git push heroku `git subtree split --prefix example/sampleapp  master`:master --force

2 comments:

  1. Nice to see your post. thanks for sharing this useful information with us.
    MSBI Training in Chennai

    ReplyDelete
  2. Thank you for providing this example! This is very kind from you! What do you think, will this base be suitable for other applications. In my case I need to adapt it for thesparklinglife.com project. I hope that it will work in this case and I will receive positive effect.

    ReplyDelete