Did you know about 'git rebase --onto'?
1. You create branch1 from master
2. You create branch2 from branch1
3. PR for branch1 gets merged into master
Now you want to rebase branch2 off of the new master, so you can make a clean PR for it.
This is actually easy!
$ git checkout branch2
$ git rebase --onto origin/master branch1 branch2
This takes all the changes between branch1 and branch2 and replays them onto master, so it's as if branch2 had been branched from master.
@fribbledom If branch1 has already been merged into master, wont a simple git rebase origin/master do this?
@gws that is why `git rebase --interactive` exists 😉
use it lavishly when you're not sure where the changes come from or go to.
I think I am fairly good with branching and rebasing, but I still use the interactive flag when I'm not sure what is coming from where and where it is going.
@fribbledom I avoid creating branches that is not branched out of the default branch unless it is a long-running branch ( which is a rare-case scenario ).
by the way, thank you for the tip :)
Server run by the main developers of the project It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!