git merge
git merge
command is used to combine the work from one branch into another, typically during development.
feature-xyz
) into a main or development branch.
rebase
, which rewrites history to make a cleaner linear flow.
git merge
? git branch feature-1
git switch feature-1
git add .
git commit -m "Implemented feature-1"
feature-1
is complete, switch back to the main
branch:
git switch main
feature-1
branch into main
git merge feature-1
feature-1
) into your current branch (i.e. main
).
git add .
git commit
git branch -d feature-1
main
git branch
git log --oneline
git merge
? git merge <branch-name>
git merge feature-branch
feature-branch
into the currently checked-out branch.
git merge --abort
git merge origin/<branch-name>
git merge origin/main
main
branch into your local branch after fetching updates.
git merge --ff-only <branch-name>
git merge --ff-only origin/main
git merge --squash <branch-name>
git merge --squash feature-branch
feature-branch
into a single commit before merging.
Your feedback helps us grow! If there's anything we can fix or improve, please let us know.
We’re here to make our tutorials better based on your thoughts and suggestions.