Simon ([personal profile] swaldman) wrote in [site community profile] dw_dev_training2012-11-22 10:05 am
Entry tags:

Git question

Scenario:

- I worked on bug A and submitted a pull request. That hasn't yet been accepted.
- I want to work on bug B, which expands upon A and changes the same bits of code.
- Since A has not yet been accepted, its changes are not yet in the develop branch. However, I still have A's branch available to me.

Is there a way in which I can base B on A and (assuming that A is accepted without changes) have it all merge nicely in the end? Or do I need to wait for A to be merged into develop first?

Also, if there is a way, is there going to be a big problem if A then *isn't* accepted / requires changes / whatever?

Thanks :-)
randomling: Mulder (The X-Files) looks up at the sky. "the truth is out there" (the truth is out there)

[personal profile] randomling 2012-11-22 12:53 pm (UTC)(link)
This from someone who hasn't worked with Git for some weeks because brain, but I think you can just switch to branch A, and then create branch B from branch A. This will start you off with all of branch A's changes, and you can then go from there.
kareila: (Default)

[personal profile] kareila 2012-11-23 07:56 am (UTC)(link)
I /think/ you can go ahead and do the work on B branched off of A, but don't submit the pull request until A is accepted on the main branch. Once that happens, you can rebase B to the main branch and submit. At least, that's what I would try to do.
cesy: "Cesy" - An old-fashioned quill and ink (Default)

[personal profile] cesy 2012-11-23 02:05 pm (UTC)(link)
As others have said, you can work on B branched off A, and even pull request B to dev, so long as you include a comment to remind reviewers they should merge A first. If they merge A with no changes, they can then merge B and it's all great. If A has changes that clash, you may then need to rebase B off the latest A or latest develop afterwards (and your pull request will automatically update when you push to your fork). If they fail to see your note and merge B first, they're implicitly merging A along with it, which is clear when they're reviewing code or commits.
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2012-12-01 11:32 am (UTC)(link)
This.

Although, if you comment on A, referring to B, B will end up having a nice big section pointing back to A, which makes it harder for a committer to accidentally commit B before A. (Harder even than a note because the section is nice and big)

AS an example, we sometimes have style-related commits that need to modify both dw-free and dw-nonfree. so if you look at the pull request in dw-nonfree (B), it contains this text:

dreamwidth/dw-free#147


If you then go to the pull request in dw-free (A), you'll see a nice big reminder to check dw-nonfree as well.