Introduction
This is a guide on how to merge a branch called “featureA” into “main” branch.
---
title: Merge featureA into main
---
%%{init: { 'logLevel': 'debug', 'theme': 'base' } }%%
gitGraph
commit id: "main-1"
commit id: "main-2"
branch featureA
checkout featureA
commit id: "feat-1"
commit id: "feat-2"
checkout main
merge featureA id: "Merge"
commit id: "main-3"
commit id: "main-4"
Lazygit
- Go to the 3. Local Branches panel.
- Press
3
.
- Press
- Hover over the “main” branch.
- Use the
↓
/↑
keys or asingle click
.
- Use the
- Checkout the “main” branch.
- Press
space
or use adouble click
.
- Press
- Hover over the “featureA” branch.
- Use the
↓
/↑
keys or asingle click
.
- Use the
- Merge the “featureA” branch into the “main” branch.
- Press
Shift+M
.
- Press
- When prompted for confirmation, continue by pressing
enter
or cancel withesc
. - If there are any merge conflicts, resolve them.
Basic Terminal
- First checkout the base branch, in this case main
- Merge “featureA” into “main” branch
- If there are merge conflicts, you will need to resolve them before you can complete the merge.
- Once conflicts are resolved for a file, stage the file
- Once all conflicts are resolved, complete the merge