Branches let you work on features independently. Merge combines changes from different branches.
Getting Started
What is Git?
Branching & Merging
Branches & Merging
Tags & Releases
Git Tags
Submodules & Subtree
Git Submodules
GitHub Actions
GitHub Actions CI/CD
Git Worktrees
Git Worktrees
Git LFS
Git LFS (Large Files)
Git
Beginner
FREE
Branches & Merging
Lesson 1 of 17
Beginner
Interactive
Syntax
GIT
git branch feature git checkout feature git checkout main git merge feature
Branching and Merging
BASH
# Create and switch to branch git checkout -b feature-login # List branches git branch # Switch branch git checkout main # Merge branch git merge feature-login # Delete branch git branch -d feature-login
Practice
1
Exercise
How do you create and switch to a new branch?
Answer
git checkout -b branch-name
Quick Quiz
1
What does "git merge" do?
git merge combines changes from one branch into another.
Interview Questions
When Git cannot automatically merge changes from two branches because the same lines were modified.