(In Github) Say I have 2 branches named master
and dev
. I work on dev
, and submit a commit c1
, then create a pull request PR1
to master
, this will fix bug1
. Before the PR1
merged (sometimes my team needs lots of time to review pull requests), I continue working, fixed bug2
so I submit a commit c2
, then I create another pull request PR2
. But I find this PR2
includes 2 commits which is c1
& c2
. This is not my intent.
So how can I create a clean PR2
from dev
branch which only include c2
commit before PR1
is merged?
And our team has rule that one pull request should only fix one bug.
Sorry for my poor English and thank you for your help.
Assuming you are using either GitHub or Bitbucket, pushing the second commit c2
should automatically update the first pull request, so typically you would not even have the need to create a new pull request.
If, for some reason, you need the c2
commit to go into master
before c1
, then this is another story.
Edit:
If you really want a second pull request containing just c2
directly on top of master
, then one approach would be to cherry-pick c2
on top of a new branch from master
:
# from master
git checkout -b new_dev
git cherry-pick c2
git push origin new_dev
Then, create a pull request from new_dev
into master
.
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.