How can I create local changes to a git subtree and then push those changes to a branch in the subtree's repo so that I can then create a pull request to merge the changes from that branch into the subtree's master?
Assume I have two repos, project and protocols, both of which are under my control.
Step 1: add protocols as a subtree in the project repo
$ git remote add protocols git@bitbucket.org:corp/protocols.git
$ git remote
origin
protocols
$ git subtree add --prefix=protocols protocols master --squash
...
From bitbucket.org:corp/protocols
* branch master -> FETCH_HEAD
* [new branch] master -> protocols/master
Added dir 'protocols'
Step 2: make some changes in the project repo to files that are in the protocols subtree
$ cd protocols
$ echo "foo" > some_file
$ git commit -a -m "added foo"
Step 3: create a branch in the protocols repo and push my local changes from project/protocols subtree to that branch
??
I'm unsure as to how best to achieve this...
Once my subtree changes have been successfully pushed to a branch in the remote protocols repo, I can then create a pull-request to merge those changes back into the protocols master.
Questions:
I have a local copy of
protocols. Should I change to that repository, create a branch, and then change back toprojectand push thesubtreechanges to my localprotocolsrepo?Can I push the
subtreechanges directly to a new branch (as of yet uncreated) in my localprotocolsrepo?Can I push the
subtreechanges directly to a new branch (as of yet uncreated) in the remoteprotocolsrepo?Is this a recommended workflow?