git-merge
Skill4 starsChanged 7 months agoMITView on GitHub
Guide and safety rules for performing git merges, ensuring no conflict markers and no duplicate lines are present. You MUST load this skill before performing a git merge.
- Deletes or force-pushes
4 other projects use a version of this.
Adopted by
Most recently taken up by
- MithunWijayasiri/dotclaudetheir own version, first seen Oct 4, 2026
- aws-solutions/konductortheir own version, first seen Sep 23, 2026
- mantaray0/crewtheir own version, first seen Jun 12, 2026
- ogromwang/skillstheir own version, first seen Jan 9, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- aws-solutions/konductor★ 9same name
- MithunWijayasiri/dotclaude★ 4same name
- ogromwang/skills★ 3same name
- mantaray0/crew★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- apache-airflow-dagsSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- catSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- coding-standard-writerSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- devcontainerSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. 0 are common, 15 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
15
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 17
When explicitly integrating a feature branch into a target branch (like main).
- Distinctive: line 18
When syncing upstream changes into your current branch to resolve an out-of-date PR.
- Distinctive: line 19
Before running a test suite that requires the absolute latest code from the base branch.
- Distinctive: line 23
When a linear history is strictly enforced by the repository policies (use git rebase instead).
- Distinctive: line 25
If you just need to apply a single, isolated commit (use git cherry-pick).
- Distinctive: line 35
Pre-Flight Check: Ensure the working directory is perfectly clean (git status) and the repository is not shallowed.
- Distinctive: line 38
Inspect Conflicts: If conflicts occur, resolve them explicitly file by file.
- Very specific: line 39
Clean File Verification: Check every resolved file to ensure absolutely no Git conflict markers (<<<<<<<, =======, >>>>>>>) remain.
- Distinctive: line 47
Clean State: Always begin a merge from a clean working tree.
- Distinctive: line 49
Ensure the repository is not shallow.
- Very specific: line 52
Non-Interactive: Prefer non-interactive commands.
- Very specific: line 71
Use tools like sort | uniq -d on specific regions or manually inspect imports and declarations.
- Very specific: line 79
Accidental Bad Merge: If the merge went wrong and you haven't pushed, use git merge --abort (if in progress) or git reset --hard HEAD~1 (if …
- Very specific: line 81
Merge Stuck in Conflict: Use git status to identify unmerged paths.
- Distinctive: line 83
Process Stuck: If git process hangs, ensure no interactive prompt was launched.
- Distinctive: line 87
Avoid using interactive merge tools that stall the agent process.
- Distinctive: line 88
Do not commit if git status shows unmerged files.
- Distinctive: line 89
Do not push a merge without first verifying the application builds and tests pass locally.
- Distinctive: line 90
Never blindly git add . without checking the contents of resolved files.
- Very specific: line 91
Never leave <<<<<<< HEAD or >>>>>>> markers in the codebase.
- Distinctive: line 96
All conflict resolution must be done via text editing tools or by fully rewriting the file content.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: git-merge
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->Execute safe and verified git merges. This skill enforces pre-merge checks, explicit conflict resolution, and strict post-merge validation to prevent duplicate lines or lingering conflict markers.
When to Use
- When explicitly integrating a feature branch into a target branch (like
main). - When syncing upstream changes into your current branch to resolve an out-of-date PR.
- Before running a test suite that requires the absolute latest code from the base branch.
When Not to Use
- When a linear history is strictly enforced by the repository policies (use
git rebaseinstead). - For extracting a specific subdirectory into a new repository (use
git-filter-branchorfilter-repo). - If you just need to apply a single, isolated commit (use
git cherry-pick).
Common Pitfalls
- Shallow History: Attempting a complex merge in a shallow-cloned repository (
fetch-depth: 1), resulting in weird conflicts or missing base commits. - Blind Commits: Running
git commit -am "merge"without actually inspecting the conflicted files, leaving<<<<<<< HEADmarkers in the production codebase. - Duplicate Imports: Resolving a conflict by keeping "both" sides without realizing that this duplicated an
importstatement or variable declaration, breaking the build.
Core Process
- Pre-Flight Check: Ensure the working directory is perfectly clean (
git status) and the repository is not shallowed. Otherwise you need to unshallow it. - Execute Merge: Perform the merge (e.g.,
git merge <branch> --no-edit --no-ff). - Inspect Conflicts: If conflicts occur, resolve them explicitly file by file.
- Clean File Verification: Check every resolved file to ensure absolutely
no Git conflict markers (
<<<<<<<,=======,>>>>>>>) remain. - Deduplication Check: Review the resolved sections to ensure no logical duplicates (e.g., duplicate imports, repeated variable declarations, or duplicate lines) were introduced.
- Commit and Validate: Finalize the merge commit, run local tests, and check the log.
Core Principles
- Clean State: Always begin a merge from a clean working tree. If there are uncommitted changes, stash or commit them first.
- Deep History: Ensure the repository is not shallow. Merging in a shallow repository can lead to unexpected results or failures.
- No Duplicate Lines: Merging can often result in duplicated logic if both branches added similar lines. You must manually verify that no duplicate imports, definitions, or statements exist post-merge.
- Non-Interactive: Prefer non-interactive commands. Do not launch
git mergetoolor GUI merge tools, and use--no-editorGIT_EDITOR=trueto avoid editor prompts during merge and commit steps. - Zero Conflict Markers: A merge must never be committed if standard Git conflict markers remain in the file.
Commands / Usage Patterns
- Check Working Directory:
git status --short - Check for Shallow Repository:
git rev-parse --is-shallow-repository(must returnfalsebefore merging to ensure full history is available) - Review Differences Before Merge:
git diff HEAD..<target-branch> --name-only - Perform Merge:
git merge <target-branch> --no-ff --no-edit -m "Merge <target-branch> into HEAD" - Find Conflict Markers:
grep -rnE "<<<<<<<|=======|>>>>>>>" .(Must return no output before finalizing the merge). - Find Duplicate Lines (heuristic):
Use tools like
sort | uniq -don specific regions or manually inspect imports and declarations. - Finalize Merge:
git commit --no-edit(if conflicts were manually resolved and added). - Unshallow Repository:
git fetch origin master --unshallow || git fetch origin master
Diagnostics and Troubleshooting
- Accidental Bad Merge: If the merge went wrong and you haven't pushed, use
git merge --abort(if in progress) orgit reset --hard HEAD~1(if already committed). - Merge Stuck in Conflict: Use
git statusto identify unmerged paths. Edit them, rungit add <file>, and thengit commit --no-edit. - Process Stuck: If git process hangs, ensure no interactive prompt was launched. Abort and rerun non-interactively.
What to Avoid
- Avoid using interactive merge tools that stall the agent process.
- Do not commit if
git statusshows unmerged files. - Do not push a merge without first verifying the application builds and tests pass locally.
- Never blindly
git add .without checking the contents of resolved files. - Never leave
<<<<<<< HEADor>>>>>>>markers in the codebase.
Limitations
- The agent cannot use graphical merge conflict tools (e.g.,
kdiff3,meld). All conflict resolution must be done via text editing tools or by fully rewriting the file content.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

