I know I can do this:
git subtree push --prefix server heroku master
to push a subtree of my project (in this case everything under the ./server directory).
And I can do the following to push a non master branch:
git push heroku somebranch:master
But I cannot seem to do any combination that looks like this to push a non master subtree:
git subtree push --prefix server heroku somebranch:master
I get:
'somebranch:master' does not look like a ref
I would so like to do this!
On my machine running Git 2.7.1 the documentation for git subtree push
says
Does a
split
(see below) using the<prefix>
supplied and then does agit push
to push the result to the repository and ref. This can be used to push your subtree to different branches of the remote repository.
There is little mention of branches at all in the documentation for git subtree
, and none of the cases where branches are mentioned fit your use case.
Reading between the lines it looks like the source branch is whatever you have checked out:
git checkout somebranch
git subtree push --prefix server heroku master
And indeed you confirmed in comments that this works.
The above answer will eventually run into problems.. When other people push. You can use the following command - I make it an alias - which will achieve the same aim, but allow deployments by multiple people.
git push heroku $(git subtree split --prefix=server $(git symbolic-ref --short -q HEAD)):master --force
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With