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.

rulesbranch-short-lived.md

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

Short-Lived Branches

Keep feature branches short-lived to minimize merge conflicts and integration challenges.

Bad Example

# Branch exists for months
git log --oneline feature/big-rewrite
# Shows commits spanning 4 months
# 200+ commits, massive diff from main

# Stale branch that diverged significantly
git checkout feature/old-feature
git diff main --stat
# 150 files changed, 10000 insertions, 5000 deletions

# "Development" branch that never merges
git checkout develop
# Perpetually behind main, used as dumping ground

# Long-running feature with no intermediate merges
git checkout -b feature/new-architecture
# 6 months later, impossible to merge

Good Example

# Feature branch lives for days, not weeks
git checkout -b feature/add-search
# Day 1: implement basic search
# Day 2: add tests, create PR
# Day 3: address review, merge

# Break large features into smaller branches
git checkout -b feature/search-api
# Merge after API is done
git checkout -b feature/search-ui
# Merge after UI is done
git checkout -b feature/search-integration
# Merge after integration is done

# Use feature flags for incomplete features
git checkout -b feature/new-checkout
git commit -m "feat: add new checkout (behind feature flag)"
# Can merge to main even though feature isn't complete

# Regular rebasing keeps branch fresh
git checkout feature/user-profile
git fetch origin main
git rebase origin/main
# Conflicts are small and manageable

Why

Short-lived branches reduce risk and improve collaboration:

  1. Fewer Conflicts: Less time to diverge from main = fewer merge conflicts
  2. Easier Reviews: Small PRs are reviewed faster and more thoroughly
  3. Faster Feedback: Issues discovered earlier in smaller increments
  4. Reduced Risk: If something goes wrong, less code to debug/revert
  5. Better Flow: Work moves through the system continuously

Guidelines for short-lived branches:

  • Target: 1-5 days
  • Maximum: 2 weeks (exceptional cases)
  • If longer needed: break into smaller pieces

Strategies for large features:

  • Feature Flags: Merge incomplete features behind toggles
  • Vertical Slices: Deliver end-to-end thin slices
  • Branch by Abstraction: Introduce new implementation alongside old
  • Dark Launching: Deploy without exposing to users

Warning signs of long-lived branches:

  • Multiple "sync with main" merge commits
  • Commit messages like "merge conflicts resolved"
  • Fear of rebasing due to size
  • Multiple developers afraid to touch the branch

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