← Module 08 · Development & Git
MODULE 08 · DEVELOPMENT & GIT

Merge

Combining changes from one Git branch into another branch.

01 · What is it?

Merge combines changes from one Git branch into another branch.

It brings the work from a source branch into a target branch so the target branch contains both lines of work.

The source branch contributes changes; the target branch receives them.

02 · Think of it like...

Think of a merge like combining two versions of a document.

One person works on a copy while another person continues the main document. When the copy is ready, the changes are brought into the main document.

Feature Branch
Merge
Main Branch

03 · What does it do?

A merge brings related development work together and records the result in the target branch.

Combine Changes

Bring work from one branch into another branch.

Update the Target

Add the source branch’s changes to the target branch.

Preserve the History

Keep the branch and commit history that explains how the work came together.

Reveal Conflicts

Stop for a decision when Git cannot safely combine overlapping edits.

04 · Where is it used?

Teams use merges whenever work developed in parallel needs to become part of another branch.

Feature WorkBring in a feature

Merge a completed feature branch into the branch used for integration.

Pull RequestsAccept reviewed work

Merge an approved pull request into its target branch.

Release PreparationCollect tested changes

Merge selected work into a release branch before deployment.

Team CollaborationCombine parallel work

Bring work from different contributors into a shared line of development.

05 · Example

A team has a main branch and a checkout-tax branch.

BranchWork
mainCurrent shared application
checkout-taxTax calculation changes

The team reviews the tax changes, then combines them into main.

The target branch is checked out before the merge:

git switch main
git merge checkout-tax

After the merge, main contains the earlier main work and the checkout-tax work.

06 · How it connects

Working Branch
Commit
Pull Request
Code Review
Merge
Target Branch

A merge is the step that brings reviewed branch work into the branch that should contain it.

07 · Do Not Confuse

Merge

Combines the changes from one branch into another branch.

Commit

Records a set of changes in the repository history.

Pull Request

Proposes that branch changes be reviewed and merged.

Rebase

Replays commits onto a different starting point; it is another way to reorganize branch history.

A pull request asks for a merge; the merge performs the branch integration.

08 · Topic Glossary

ENGLISH TERM中文SIMPLE ENGLISH中文小白理解
Merge合并Combining changes from one branch into another branch.把一个分支的修改合并到另一个分支。
Branch分支A separate line of work in a Git repository.代码仓库里一条独立的开发线路。
Source Branch源分支The branch whose changes are being brought into another branch.要把修改带到别的分支里的分支。
Target Branch目标分支The branch that receives the merged changes.接收合并后修改的分支。
Commit提交A saved set of changes in Git history.Git 历史中保存下来的一组修改。
Conflict冲突A situation where Git cannot combine overlapping changes automatically.不同修改重叠,Git 无法自动决定保留哪一个。
Fast-forward快进A merge where the target branch can move directly to the source branch’s latest commit.目标分支可以直接移动到源分支最新提交的合并方式。
Pull Request拉取请求A request for people to review and integrate branch changes.请别人评审并把分支修改合并进去的请求。

09 · What to Remember

Merge combines changes from one Git branch into another branch.

The source branch provides the changes, and the target branch receives them.

A merge may be automatic, or it may require resolving a conflict.

↑