How can I push a part of my git repo to Heroku?

后端 未结 3 629
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 11:23

I have a multi-module app that is already on Github. It is comprised of two modules, one of them an Android app and the other a Rails based Web app. So my project\'s directo

相关标签:
3条回答
  • 2020-12-07 11:42

    The git subtree command (built in, now) is a good way to do this. If you want to push a subtree of a branch to become your master, you can use something like:

    git push --force heroku `git subtree split --prefix web HEAD`:master

    0 讨论(0)
  • 2020-12-07 11:58

    You can use git subtree push. It will generate a new commit tree with your directory as root, and push it.

    git subtree push --prefix web heroku master
    

    Full documentation is here.

    0 讨论(0)
  • 2020-12-07 12:02

    You could also use git branches instead of subfolders. If you have git 1.7.2 or newer, you can simply do git checkout --orphan android to create a branch that is disconnected from your master branch (assumed here to be the web folder). Once you have checked out the orphan branch, run git rm -rf . to remove existing files before copying in your android-specific files to the now empty root directory.

    If you want to use separate folders for each module, you can clone the repository twice and use this structure:

    ProjectRoot
    ├── android
    │   └── .git
    └── web
        └── .git
    
    0 讨论(0)
提交回复
热议问题