3 ms·
Ah I think where you're going wrong is trying to merge master into PR 2. Instead you should just rebase PR 2 on top of master. Git will automatically figure out
by IshKebab 3y ago
Ah I think where you're going wrong is trying to merge master into PR 2. Instead you should just rebase PR 2 on top of master. Git will automatically figure out that PR 1 has been merged and drop it. If it doesn't for some reason you can just do an interactive rebase.
Git history isn't "the truth" until it's shared. There's absolutely no issue rewriting history history for your own edits that nobody else is using yet. You do that every time you press undo!
- atq2119 3y ago> Git will automatically figure out that PR 1 has been merged and drop it. Unfortunately, that part doesn't work if you let GitHub do a squash, because then the commit on main has no corresponding commit on (the branch of) PR2. When cherrypicking the commits corresponding to PR1 during the rebase, the merge algorithm will notice that the change is already there and notify you of the empty commit if the change is completely identical. But if it isn't, that falls down. It's still not too difficult to recover, but it's annoying.
- IshKebab 3y ago> Unfortunately, that part doesn't work if you let GitHub do a squash, because then the commit on main has no corresponding commit on PR2. Did you try it? It does still work. Git will detect that the changes are identical and drop it, even if the commit hash is different.