Don Nisnoni
Don Nisnoni

Reputation: 104

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

Okay ... here's the situation:

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.

Upvotes: 4

Views: 1518

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 21908

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.

Upvotes: 4

Related Questions