What is Git Merge?

git merge is a command that integrates changes from one branch into another.

Basic Merge

git checkout main
git merge feature-branch

This merges feature-branch into main.

Merge Conflicts

If there are conflicting changes, Git will pause the merge and let you resolve conflicts manually.

View Merge Conflicts

git status

Lists files with conflicts.

After Resolving Conflicts

git add filename.txt
git commit

Stage the resolved files and complete the merge with a commit.

Abort a Merge

git merge --abort

Cancel the merge and return to the pre-merge state.