Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

If a pull request is not yet closed can I create one more pull request for the same branch

T_Naveen_Kumar April 9, 2020

If a pull request is created by me is  in Open status and I got some comments from my reviewer,

there is some other code that I need to get reviewed so can I create one more Pull request for this other code for the same branch.

How many Open Pull request can be there for a single branch

1 answer

1 accepted

3 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 2020

Hello @T_Naveen_Kumar ,

There can be only one open PR from a given branch. However, you can create a new branch from the tip (branch is just a pointer to a commit) and work from there.

The only catch here is that when you create a PR from that new branch, you'd likely want to target it to the first branch rather than to the same branch as the first PR is targeted to. Otherwise the second PR will show changes from both first and second branches unless the first PR is merged. Does this make sense?

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

T_Naveen_Kumar April 10, 2020

Hello @Daniil Penkin ,

Firstly thanks for your response. I created a new branch but still, I was able to see the commits of previous pull request while creating a new pull request.

Did I chose the wrong point of creating a branch, I created at the same point where my previous repository was existing.

 

Regards,

Naveen

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 12, 2020

Hello @T_Naveen_Kumar ,

This is expected, since your second branch contains some or all commits of the first branch (depending on whether you have updated it or not after you branched off the second branch).

This is what I meant in this paragraph:

The only catch here is that when you create a PR from that new branch, you'd likely want to target it to the first branch rather than to the same branch as the first PR is targeted to. Otherwise the second PR will show changes from both first and second branches unless the first PR is merged. Does this make sense?

If you have a "stacked" pull requests, target it to the underlying branch, not to the final target branch. This will make the second PR only show new changes.  As soon as you merge the first PR, the second one will be automatically retarget to the correct branch.

Let me try to depict this:

Stacked PRs.png

A pull request on this picture is a coloured right-to-left arrow, and the rectangle of the same colour shows the commits involved in that PR. Now check the difference between PR 2 and PR 3: the former one contains all commits since the branch diverted from master (leftmost branch), while the latter only contains commits from the latest branch point as it is pointing not to master but to the first branch. As soon PR 1 is merged, PR 3 will be automatically retargeted to master.

Does this make sense?

Cheers,
Daniil

Like # people like this
T_Naveen_Kumar April 13, 2020

@Daniil Penkin  Thanks for the detailed explanation. I got the point now

Like Daniil Penkin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events