Introduction
This is a guide on how to rebase a branch called “featureA” over “main” branch.
---
title: before
---
%%{init: { 'logLevel': 'debug', 'theme': 'base' } }%%
gitGraph
commit id: "main-1"
commit id: "main-2"
branch featureA
checkout featureA
commit id: "feat-1"
checkout main
commit id: "main-3" type: HIGHLIGHT
checkout featureA
commit id: "feat-2"
checkout main
commit id: "main-4" type: HIGHLIGHT
---
title: after
---
%%{init: { 'logLevel': 'debug', 'theme': 'base' } }%%
gitGraph
commit id: "main-1"
commit id: "main-2"
commit id: "main-3" type: HIGHLIGHT
commit id: "main-4" type: HIGHLIGHT
branch featureA
checkout featureA
commit id: "feat-1"
commit id: "feat-2"
Lazygit
- Go to the 3. Local Branches panel.
- Press
3
.
- Press
- Hover over the “featureA” branch.
- Use the
↓
/↑
keys or asingle click
.
- Use the
- Checkout the “featureA” branch.
- Press
space
or use adouble click
.
- Press
- Hover over the “main” branch.
- Use the
↓
/↑
keys or asingle click
.
- Use the
- Rebase the “featureA” branch over the “main” branch.
- Press
r
.
- Press
- When prompted for confirmation, continue by pressing
enter
or cancel withesc
.- Add#screenshot of rebase confirmation prompt.
- If there are any merge conflicts, resolve them.
- Add#screenshot of Auto-merge failed notification
Basic Terminal
- First checkout the feature branch that you want to rebase
- Then rebase it over main branch
- If there are conflicts, you will need to resolve them before you can continue the rebase.
- Once conflicts are resolved for a file, stage the file
- Once all conflicts are resolved, continue the rebase