Beginner Topic 8 of 50 DevOps & Tooling
Branching and Merging
Parallel lines of development and combining them.
How it works
A branch is a movable pointer to a commit, so creating one is nearly free. Developers branch to work on a feature or fix in isolation, then merge it back. A fast-forward merge simply moves the pointer when no divergence exists, while a three-way merge creates a merge commit joining two lines of history. Rebase instead replays commits on top of another branch for a linear history, and squash merging collapses a branch into one commit. Tools such as git switch, git merge and git branch -d manage the cycle.
Where it is used
Teams use branches for feature work, release lines, hotfixes and experiments, and combine them with pull requests and CI checks before merging into main.
Common pitfall
Long-lived branches drift and produce painful conflicts, and rebasing commits that others already pulled rewrites shared history. Keep branches short, sync with main often and agree on a merge strategy for the team.
Where it fits in the course
Branching and Merging is topic 8 of 50 in DevOps & Tooling, rated Beginner. It follows Git Basics. The next topic is Pull Requests.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the DevOps & Tooling quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the DevOps & Tooling quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Branching and Merging?
Where do people use Branching and Merging?
What is the most common mistake with Branching and Merging?
What should I learn before this topic?
How can I practice it?
Is Branching and Merging hard to learn?
How long does it take to learn Branching and Merging?
Which topics are related to Branching and Merging?
What should I study after Branching and Merging?
Related topics
- Git Basics (DevOps & Tooling)
- Pull Requests (DevOps & Tooling)
- Environment Variables (DevOps & Tooling)
- Resolving Merge Conflicts (DevOps & Tooling)