Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials Git Branches & Merging
Git Beginner FREE

Branches & Merging

Lesson 1 of 17 Beginner Interactive

Branches let you work on features independently. Merge combines changes from different branches.

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.