Description 612 -> 273 chars, body 1124 -> 457 words. Branch patterns, operations, merging, comparison, and the orchestrator contract move to references/. Corrects rebase routing in four places: this skill sent rebase to git-history, which carries no rebase content and disclaims it. Rebase is git-commits'; cherry-pick and revert stay git-history's. Drops a Step 3 gate on a rebase flow this skill does not have.
30 lines
1.2 KiB
Markdown
30 lines
1.2 KiB
Markdown
---
|
|
source_keys:
|
|
- context7-git-htmldocs
|
|
---
|
|
|
|
# Merging one branch into another
|
|
|
|
Scope is fast-forward and merge-commit mechanics plus conflict resolution. Rebase belongs to
|
|
`git-commits`; cherry-pick and revert to `git-history`.
|
|
|
|
- **Fast-forward** — `git merge <branch>` advances the pointer with no merge commit when the
|
|
target has not diverged.
|
|
- **True merge** — `git merge --no-ff <branch>` forces a merge commit even when a fast-forward is
|
|
possible. Gitflow requires it on every supporting-branch merge.
|
|
- **Squash merge** — `git merge --squash <branch>` stages the combined diff without committing.
|
|
Follow it with a `git commit`.
|
|
- **Octopus merge** — `git merge branch-a branch-b branch-c` merges more than two branches at
|
|
once, but fails outright on any conflict. Use sequential two-way merges when conflicts are
|
|
likely.
|
|
|
|
## Conflict resolution
|
|
|
|
When Git cannot auto-merge it writes conflict markers and stops mid-merge. Run `git status` to
|
|
list the conflicted files, edit each to resolve its markers, then `git add <file>` and
|
|
`git merge --continue`.
|
|
|
|
- `git merge --abort` restores the pre-merge state.
|
|
- `git mergetool` opens the configured merge tool.
|
|
- `git diff --diff-filter=U` shows only the still-conflicted files.
|