
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
mainbranch - 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-1We then made
branch-2frombranch-1and made some commits on itWe then went back to
branch-1and made some different commitsWe now need to rebase the commits on
branch-2to be on top ofbranch-1Starting 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 selectmainif you are rebasing on top of main) and click Rebase
Hopefully the rebase will be successful, if there are merge conflicts you will need to resolve those
