I have a unique scenario where I'm working with one other person on a project (that comprises a single GitHub repo) and I'm responsible for the design, some development & doing the code reviews + PR merges. I want to try and stick with GitFlow as much as possible here, and I only want to be the one who can merge PRs from feature branches back into develop. So the auth model I'm going with (at least tentatively) is:
master
and develop
develop
So now we're in an interesting flow here:
feature/12345
) off of develop
and worked on it for a few days then pushed his changes to GitHub feature/23456
) off of his first feature branch and begin working. feature/12345
, made some changes to it and then pushed those changes. At the same time he worked on feature/23456
. feature/12345
, I merged it into develop
and asked him to pull my changes into his feature/23456
. Will he be able to create a PR to merge feature/23456
into develop
, or will this "branch of a branch" scenario screw things up with GitHub? Will I be able to actually do the merge, or do I need to do some kind of rebase (if so what do the commands for this look like)?
If your colleague hasn't yet pushed feature/23456
to GitHub, he should pull updated develop
and rebase feature branch on top of it:
feature/23456
git rebase develop
That's it, now his feature branch looks like it was always growing from the top of the develop
.
If rebasing isn't an option, most probably, git will be able to handle merging branch of another branch just fine without additional magic, but can't say for sure.
If for some reason things go bad way, there is always dumb and not elegant, but bullet-proof solution. It's always possible to create new branch from develop
and simply cherry-pick
all necessary commits from feature/23456
into it, making "fresh duplicate" of it to keep things simple.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.