1

So this isn't your typical 'just rebase' issue (Atleast I don't think).

I'd like to know how I can create more than one pull request without effecting past commits. Here is my current scenario:

  1. I forked a repository
  2. I made the change on my local master (so stupid, I know)
  3. I made a PR with the changes
  4. They were accepted but are auto-merged by a bot in a few days

Here's the problem, I'd like to keep contributing but with individual PR's in the meantime that don't list all the old (but yet to be merged) commits I've made. My idea was to get upstream, rebase my master, and work from there (properly this time with branches). However upstream/master conflicts with master so it won't allow me to. I'm afraid to rebase my local master with the current original because I fear it may 'delete' the code for my pull request and somehow invalidate it.

Any idea how I can fix this? Or do I just have to wait for the bot to make the merge from my PR then rebase from master.

Aaron
  • 35
  • 5

1 Answers1

1

My idea was to get upstream, rebase my master

Don't: set a branch on your current local master, where you have your old (but yet to be merged) commit.

git switch -c mywip master

(wip: work in progress)
This uses the new git switch command (Git 2.23+)

Then reset master to upstream master

git fetch upstream
git switch master
git reset --hard upstream/master

Work from there, in a new branch, for a new future PR (based on a code which does not list the old -- but yet to be merged -- commits).

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283