Branches and Merging
Part of the Git course
Every commit you have made so far sits on one single line of history called main. Real work rarely stays that simple. You want to try an idea without risking the working version, or two people need to work on different features at the same time without stepping on each other. Git's answer is the branch: a lightweight, movable label pointing at a commit.
This lesson works in the hello-git repository from lesson 01, rebuilt here so the lesson also works on its own. Press Play to create it in this lesson's folder with one commit (pressing it again starts over) ...
Want to learn Git Branches and Merging in a real environment?
Click below, get a fresh Linux box with Git ready to go, and work through Branches and Merging hands-on with an AI tutor that knows your code.
Start this lessonBranches and MergingWhat you'll learn
- Git branch
- Git switch
- Fast-forward merge
- Three-way merge
- Merge commit
Read this lesson in your language
All lessons in this course
13 lessons- 1Init and Your First Commit25 min
- 2Status, Diff, and Log25 min
- 3Branches and Merging30 min
- 4Resolving Merge Conflicts30 min
- 5Remotes: Push, Pull, Fetch30 min
- 6Stash and Cherry-pick25 min
- 7Rebasing30 min
- 8Interactive Rebase and Squashing30 min
- 9Tags and Releases20 min
- 10Branching Workflows20 min
- 11Recovering Lost Work25 min
- 12Hooks25 min
- 13Capstone: A Full Pull Request Flow40 min
