Git Workflow Skill
Purpose
Help users integrate branches safely and confidently, with practical, beginner-friendly guidance for merge, rebase, conflict resolution, and recovery.
When To Use
Use for branch sync, pull request preparation, merge vs rebase decisions, conflict handling, rebasing feature branches, preserving a shared branch history, undoing bad integrations, and explaining Git commands before running them.
Priorities
- Safety first - avoid data loss and risky history rewrites.
- Clarity - explain why each command is used.
- Correctness - preserve intended code changes during integration.
- Recoverability - always keep a path to undo.
- Team compatibility - prefer workflows that match shared branch policies.
Coverage
- Branch graph understanding and branch hygiene
- Merge workflows (fast-forward, no-fast-forward, and merge commits)
- Rebase workflows (interactive and non-interactive)
- Conflict resolution for merge and rebase
- Commit cleanup before PR (squash, reorder, edit messages)
- Commit message drafting using the shared
commit-message skill/template
- Cherry-pick for selective change transfer
- Syncing from remote and handling divergence
- Recovery with reflog, reset, revert, and abort commands
- Force-push safety (
--force-with-lease, never blind --force)
Merge Vs Rebase
- Choose merge when preserving true branch history matters, the branch is shared, or policy prefers merge commits.
- Choose rebase when you want a linear history and the branch is private or not yet widely shared.
- Never rebase published/shared branches without explicit agreement.
Workflow
- Preflight safety checks.
git status to ensure a clean state.
git fetch --all --prune to refresh remote state.
git branch --show-current and git log --oneline --graph --decorate --all -n 30 to confirm branch topology.
- Pick integration strategy intentionally.
- Merge path:
git checkout <target> then git merge <source>.
- Rebase path:
git checkout <feature> then git rebase <base>.
- Resolve conflicts carefully.
- Inspect files with conflict markers.
- Keep intended logic, then
git add <resolved-files>.
- Continue with
git merge --continue or git rebase --continue.
- If needed, stop safely with
git merge --abort or git rebase --abort.
- Validate result.
- Re-run tests/build relevant to touched code.
- Review history with
git log --oneline --graph -n 30.
- Publish safely.
- For rebased branches, use
git push --force-with-lease.
- For merged branches, use normal
git push.
- Recover if something went wrong.
- Use
git reflog to locate prior HEAD.
- Use
git reset --hard <reflog-entry> only with explicit confirmation.
- Prefer
git revert for undoing changes on shared branches.
Conflict Resolution Playbook
- Identify conflict scope: file-level and commit-level intent.
- Prefer semantic resolution (correct behavior) over mechanical marker deletion.
- Resolve one file at a time and stage incrementally.
- Re-run focused validation after each major conflict cluster.
- If conflict density is high, abort and retry with smaller steps.
Review Checklist
- Is the chosen strategy (merge/rebase) appropriate for this branch and team policy?
- Is the branch clean and synced before integration?
- Were all conflicts resolved intentionally (not accidentally dropped)?
- Is commit history understandable for reviewers?
- Was force push done only with
--force-with-lease and only when appropriate?
- Is there a clear rollback path documented if needed?
Commit Messages
When drafting, editing, or reviewing a Git commit message, read ../commit-message/SKILL.md and follow the shared Git/P4 commit message template referenced there.
Constraints
- Do not recommend rewriting shared branch history without explicit approval.
- Do not use blind
git push --force.
- Do not continue a conflicted merge/rebase without reviewing every conflict chunk.
- Do not suggest destructive commands (
reset --hard, branch deletion) without warning and recovery guidance.
- Do not hide uncertainty; call out assumptions about branch ownership and remote policy.
Output
Provide:
- a concrete command sequence tailored to the current branch situation
- a merge vs rebase rationale in plain language
- conflict-resolution guidance for the exact files or conflict types involved
- a rollback/recovery plan before risky steps
- post-integration validation steps
Source: miaodi/llm_config — distributed by TomeVault.
1---2name: git-workflow-453description: Use when planning or executing Git branch workflows, especially merge/rebase across branches, conflict resolution, safe history rewriting, and recovery from mistakes.4---56# Git Workflow Skill78## Purpose9Help users integrate branches safely and confidently, with practical, beginner-friendly guidance for merge, rebase, conflict resolution, and recovery.1011## When To Use12Use for branch sync, pull request preparation, merge vs rebase decisions, conflict handling, rebasing feature branches, preserving a shared branch history, undoing bad integrations, and explaining Git commands before running them.1314## Priorities151. Safety first - avoid data loss and risky history rewrites.162. Clarity - explain why each command is used.173. Correctness - preserve intended code changes during integration.184. Recoverability - always keep a path to undo.195. Team compatibility - prefer workflows that match shared branch policies.2021## Coverage22- Branch graph understanding and branch hygiene23- Merge workflows (fast-forward, no-fast-forward, and merge commits)24- Rebase workflows (interactive and non-interactive)25- Conflict resolution for merge and rebase26- Commit cleanup before PR (squash, reorder, edit messages)27- Commit message drafting using the shared `commit-message` skill/template28- Cherry-pick for selective change transfer29- Syncing from remote and handling divergence30- Recovery with reflog, reset, revert, and abort commands31- Force-push safety (`--force-with-lease`, never blind `--force`)3233## Merge Vs Rebase34- Choose merge when preserving true branch history matters, the branch is shared, or policy prefers merge commits.35- Choose rebase when you want a linear history and the branch is private or not yet widely shared.36- Never rebase published/shared branches without explicit agreement.3738## Workflow391. Preflight safety checks.40 - `git status` to ensure a clean state.41 - `git fetch --all --prune` to refresh remote state.42 - `git branch --show-current` and `git log --oneline --graph --decorate --all -n 30` to confirm branch topology.432. Pick integration strategy intentionally.44 - Merge path: `git checkout <target>` then `git merge <source>`.45 - Rebase path: `git checkout <feature>` then `git rebase <base>`.463. Resolve conflicts carefully.47 - Inspect files with conflict markers.48 - Keep intended logic, then `git add <resolved-files>`.49 - Continue with `git merge --continue` or `git rebase --continue`.50 - If needed, stop safely with `git merge --abort` or `git rebase --abort`.514. Validate result.52 - Re-run tests/build relevant to touched code.53 - Review history with `git log --oneline --graph -n 30`.545. Publish safely.55 - For rebased branches, use `git push --force-with-lease`.56 - For merged branches, use normal `git push`.576. Recover if something went wrong.58 - Use `git reflog` to locate prior HEAD.59 - Use `git reset --hard <reflog-entry>` only with explicit confirmation.60 - Prefer `git revert` for undoing changes on shared branches.6162## Conflict Resolution Playbook631. Identify conflict scope: file-level and commit-level intent.642. Prefer semantic resolution (correct behavior) over mechanical marker deletion.653. Resolve one file at a time and stage incrementally.664. Re-run focused validation after each major conflict cluster.675. If conflict density is high, abort and retry with smaller steps.6869## Review Checklist70- Is the chosen strategy (merge/rebase) appropriate for this branch and team policy?71- Is the branch clean and synced before integration?72- Were all conflicts resolved intentionally (not accidentally dropped)?73- Is commit history understandable for reviewers?74- Was force push done only with `--force-with-lease` and only when appropriate?75- Is there a clear rollback path documented if needed?7677## Commit Messages78When drafting, editing, or reviewing a Git commit message, read `../commit-message/SKILL.md` and follow the shared Git/P4 commit message template referenced there.7980## Constraints81- Do not recommend rewriting shared branch history without explicit approval.82- Do not use blind `git push --force`.83- Do not continue a conflicted merge/rebase without reviewing every conflict chunk.84- Do not suggest destructive commands (`reset --hard`, branch deletion) without warning and recovery guidance.85- Do not hide uncertainty; call out assumptions about branch ownership and remote policy.8687## Output88Provide:89- a concrete command sequence tailored to the current branch situation90- a merge vs rebase rationale in plain language91- conflict-resolution guidance for the exact files or conflict types involved92- a rollback/recovery plan before risky steps93- post-integration validation steps9495---96> Source: [miaodi/llm_config](https://github.com/miaodi/llm_config) — distributed by [TomeVault](https://tomevault.io).97<!-- tomevault:4.0:skill_md:2026-06-16 -->