Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create linked/chained pull request on GitHub

Tags:

git

github

I have multiple feature branches, and usually when i do a git push from my feature branch (checked out locally) , gitHub wants to merge to the master.

However, i have observed pull requests which contain commits from different feature branches all rolled into one PR. I have also seen commits from different feature branches trying to merge commits into the other, all in one PR.

None of the branches exist on the github repo yet.

How is this done ?

Pardon me if this question is too trivial, i'm new to github !

like image 422
user1354825 Avatar asked Sep 17 '26 23:09

user1354825


1 Answers

When you create a pull request, you can specify the base branch, which is the branch it's based off of and into which it will be merged. If you set the base branch of your first PR to master and you set the base branch of subsequent PRs to that of your first PR, then those subsequent PRs will merge into your first PR, and then it will merge into master.

Typically, you'd only want to do this if you had multiple related PRs, or if you had one series that built upon another. If you have the latter case, GitHub will exclude commits in the base branch (that is, the first PR's branch) from display in the latter, showing only the commits that are new in your other PR.

like image 82
bk2204 Avatar answered Sep 19 '26 21:09

bk2204