All skills
asyrafhussin avatar

/git-workflow

@b02a263

Git best practices, branching strategies, commit conventions, and PR workflows. Use when reviewing git history, writing commits, setting up branching strategy, or improving git practices. Triggers on "git best practices", "commit message", "branching strategy", or "PR workflow".

Use this Skill: https://skilld.dev/gh/asyrafhussin/agent-skills/git-workflow

This session only. Nothing lands on disk.

rulescollab-conflict-resolution.md

≈881 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Merge Conflict Resolution

Handle merge conflicts carefully and systematically to maintain code integrity.

Bad Example

# Blindly accepting one side
git checkout --ours .
git add .
git commit -m "resolve conflicts"
# Potentially lost important changes

# Blindly accepting incoming changes
git checkout --theirs .
git add .
git commit -m "resolve conflicts"
# Potentially lost your own work

# Leaving conflict markers in code
<<<<<<< HEAD
const timeout = 5000;
=======
const timeout = 10000;
>>>>>>> feature/update-timeout
# Code doesn't compile, markers committed

# Not testing after resolution
git add .
git commit -m "merge conflict resolved"
git push
# Broken code pushed without verification

# Complex merge without understanding both sides
# "I'll just delete this stuff and hope it works"

Good Example

# Check conflict status
git status
# Shows files with conflicts

# View conflicts in detail
git diff --check

# Open conflicted file and understand both changes
# Look for conflict markers:
# <<<<<<< HEAD (your changes)
# =======
# >>>>>>> branch-name (their changes)

# Resolve thoughtfully, keeping necessary parts of both
# Before:
<<<<<<< HEAD
function calculateTotal(items) {
    return items.reduce((sum, item) => sum + item.price, 0);
}
=======
function calculateTotal(items, taxRate) {
    const subtotal = items.reduce((sum, item) => sum + item.price, 0);
    return subtotal * (1 + taxRate);
}
>>>>>>> feature/add-tax

# After (merged thoughtfully):
function calculateTotal(items, taxRate = 0) {
    const subtotal = items.reduce((sum, item) => sum + item.price, 0);
    return subtotal * (1 + taxRate);
}

# Stage resolved file
git add src/utils/pricing.js

# Continue rebase or complete merge
git rebase --continue
# or
git commit -m "merge: resolve conflict in pricing calculation

Merged tax calculation feature with existing implementation.
Made taxRate optional with default of 0 for backward compatibility."

# Verify resolution
npm test
npm run build

Why

Proper conflict resolution prevents bugs and preserves work:

  1. Code Integrity: Both sets of changes are considered
  2. Functionality: Merged code works correctly
  3. History Clarity: Meaningful merge commit explains resolution
  4. Team Trust: Others' work is respected
  5. Prevention: Understanding conflicts helps prevent future ones

Conflict resolution workflow:

# 1. Identify conflicts
git status

# 2. For each conflicted file:
#    - Open in editor
#    - Understand both versions
#    - Create merged version
#    - Remove conflict markers
#    - Stage the file
git add <resolved-file>

# 3. Complete the merge/rebase
git commit  # for merge
git rebase --continue  # for rebase

# 4. Verify everything works
npm test
npm run build

# 5. Push when confident
git push

Useful tools for conflict resolution:

# Use merge tool
git mergetool

# View specific version
git show :1:file  # Common ancestor
git show :2:file  # Your version (HEAD)
git show :3:file  # Their version (incoming)

# Abort if overwhelmed
git merge --abort
git rebase --abort

Prevention strategies:

  • Keep branches short-lived
  • Sync with main frequently
  • Communicate about overlapping work
  • Use feature flags to avoid parallel changes
  • Coordinate large refactors with the team

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides a comprehensive and secure set of guidelines for managing Git workflows, including commit message standards, branching strategies, and pull request best practices. It promotes industry-standard tools and safety measures, such as protected branches and automated linting, with no malicious patterns detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    19/32 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at b02a263. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 7 months ago
metadata
{
  "author": "AsyrafHussin",
  "version": "1.2.0"
}

README badge

README badge for asyrafhussin/agent-skills/git-workflow