Git-subrepo: Creating multiple branches of subrepo to be used in PR.

Created on 13 Apr 2016  路  5Comments  路  Source: ingydotnet/git-subrepo

Hi,

It might be, that I just didn't understand something already written in the wiki but I was wondering if the following workflow is possible.

Let's say I have a project which is my master and I have forked some third-party library in GitHub.
Now I use git subrepo clone to make that library a subrepo of my main project.

Now the hard part:
I now fix some two bugs in different files of the library. Normally I would do so in two separate branches and create a pull request for both of them so others can profit from that fix too.

Is that workflow still possible with git subrepo or do I need a sperate "normal" clone of that library where I do that and just pull in the changes later with subrepo?

Thanks :)

Question

All 5 comments

You can use the -b parameter to git subrepo push to push to a new branch in the subrepo. So if you first create a local branch, then fix things and use git subrepo push -b new_branch you will get a new branch in the subrepo repository. And can create a PR from that.

Does that answer your question?

Just a quick follow up. When you say create a local branch you are talking about using
git checkout -b ... thus creating a branch of the complete project right?

And yes I think this does answer my question, thanks!

Yes I meant using git checkout -b ..., I do realize that you don't need to create a local branch, you can just push to another subrepo branch if you want to.

Well if I have two separate fixes I would need to branch. I just did't think about the option of branching the whole project. But this definitely does what I need.

So thanks again! If you don't have anything to add, this can be closed.

Nothing to add, closing.

Was this page helpful?
0 / 5 - 0 ratings