7 Rebasing a branch
7.1 Rebasing a branch
- Performing a rebase puts the commits you have on your branch on top of the commits from another branch
- We commonly do this when our colleagues have merged PRs into say the
main
branch - We would then rebase our branch on top of
main
- A rebase can be performed in GitHub Desktop as follows
In these screenshots we assume we started working on
branch-1
We then made
branch-2
frombranch-1
and made some commits on itWe then went back to
branch-1
and made some different commitsWe now need to rebase the commits on
branch-2
to be on top ofbranch-1
Starting on
branch-2
, select Branch | Rebase current branch…Or/then from the middle panel select the branch to rebase on top of - select
branch-1
(or selectmain
if you are rebasing on top of main) and click RebaseHopefully the rebase will be successful, if there are merge conflicts you will need to resolve those