merge
Combining the work of two branches into one, either by moving a branch forward (a fast-forward) or by recording a merge commit.
In more detail
git merge feature brings feature's commits into the current branch. If the current branch has no commits the other lacks, Git just moves the label forward; if both moved, Git combines the changes since their merge base and records a commit with two parents. Merging never rewrites existing commits, which is why it is safe on shared branches.
Examples
git merge featureIn this course: A quality gate decides whether a change is safe to merge. Mark review comments that must be fixed before merge separately from preferences.Related terms
- pull request — A request on a hosting service such as GitHub to merge one branch into another, with a page for review, discussion and automated checks.
- branch — In Git, a movable name for one commit; committing on the branch moves the name forward to the new commit.
- GitOps — Operating a system by keeping its desired state in Git and letting a controller continuously make the live system match it.
- merge conflict — The situation where two branches changed the same lines differently since their merge base, so Git cannot combine them and asks you to choose.
- semantic conflict — A clash in meaning between two changes that merge cleanly as text but break the program together.
- fast-forward — A merge where the current branch has nothing new, so Git simply moves it forward to the other branch's commit without creating a merge commit.
- merge commit — A commit with two (or more) parents, recording the point where two lines of history were joined.
- merge base — The newest commit that two branches both contain, the point where their histories split.
- rebase — Moving a series of commits so they start from a different commit, by replaying each one as a new commit with a new ID.
- quality gate — A check, or set of checks, that a change must pass before it can move on, such as being merged or promoted to the next pipeline stage.
Taught in
- What Is a Pipeline? — Continuous Integration & Continuous Delivery Pipelines
- What is GitOps? — Continuous Integration & Continuous Delivery Pipelines
- Trunk-Based Development Versus Git Flow — DevOps & Site Reliability Engineering
- Installing Git, And Telling It Who You Are — Advanced Git Internals & Distributed Workflows
- What A Commit Really Is — Advanced Git Internals & Distributed Workflows
- Committing, And What A Good Message Says — Advanced Git Internals & Distributed Workflows
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows
- A Branch Is A Moving Pointer — Advanced Git Internals & Distributed Workflows
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows
- Merging: Fast Forward Or A Merge Commit — Advanced Git Internals & Distributed Workflows
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows
- Fetch Is Not Pull — Advanced Git Internals & Distributed Workflows
- The Pull Request, And Branch Naming — Advanced Git Internals & Distributed Workflows
- Why Conflicts Happen — Advanced Git Internals & Distributed Workflows
- Resolving A Conflict, Line By Line — Advanced Git Internals & Distributed Workflows
- Cherry Picking, Reflog, And Getting Work Back — Advanced Git Internals & Distributed Workflows
- Trunk Based Development Versus Git Flow — Advanced Git Internals & Distributed Workflows
- The Workflow That Ran On A Stranger's Pull Request — GitHub Actions (GH-200) Exam Prep
- Workflow Structure: Jobs, Env, Services, Commands And Anchors — GitHub Actions (GH-200) Exam Prep
- Outputs, Artifacts, Caches And Job Summaries — GitHub Actions (GH-200) Exam Prep
- Why It Ran, Why It Did Not: Reading Runs, Jobs And Checks — GitHub Actions (GH-200) Exam Prep
- Governing Actions: Allow Lists, SHA Pinning And Rulesets — GitHub Actions (GH-200) Exam Prep
- GITHUB_TOKEN: Least Privilege, Job By Job — GitHub Actions (GH-200) Exam Prep
- Script Injection: When An Issue Title Becomes Code — GitHub Actions (GH-200) Exam Prep
- YAML-Reading Sprint: What Happens When This Runs? — GitHub Actions (GH-200) Exam Prep
- Code Review As A Quality Gate — Automated Testing, TDD & Quality Engineering
- Writing Actionable Review Comments — Automated Testing, TDD & Quality Engineering