简体   繁体   中英

Make a new Pull Request on the same branch where the last commit hasn't been merged yet

Okay ... here's the situation:

  • I forked a repository
  • I made a new branch. the branch name is configs
  • I committed a few changes and made pull request #1
  • Pull request #1 is still being reviewed and has not been merged on the base repository
  • I made a few more changes. still in the configs branch. but this new change does not affect previous changes (different files)
  • I made a new commit and of course it is still in configs brach
  • When I look at github, this new commit will go to the previous pull request, pull request #1.

Well, my question is "How do you make this new commit as a new pull request or lets say pull request #2 but still in the same brach?"

thanks.

Put your second commit on another branch

# now

A---B---C <<< main-line
         \
          D---E <<< configs

# target

A---B---C <<< main-line
         \
          D <<< configs
           \
            E <<< configs-plus

To achieve that, step by step :

# start from branch configs
git checkout configs

# Create the new branch (by default, it'll point at HEAD, so configs)
git branch configs-plus

# reset current branch (still configs) to last commit
git reset --hard @^

# finally, push (--force (or -f) needed because history has been rewritten)
git push -f origin HEAD

Then create a new PR configs-plus > main-line . The first PR will have been updated by the force push to remove the second commit.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM