home / skills / jackspace / claudeskillz / git-workflow-helper

git-workflow-helper skill

/skills/git-workflow-helper

This skill guides you through Git workflows, enabling clean histories, safe branching, and reliable recovery with practical commands and best practices.

npx playbooks add skill jackspace/claudeskillz --skill git-workflow-helper

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
986 B
---
name: git-workflow-helper
description: Expert guidance for Git workflows, troubleshooting, and best practices
---

# Git-workflow-helper

## Instructions

When working with Git:
- Commit early and often
- Write clear commit messages (imperative mood)
- Use branches for features/fixes
- Rebase before merge for clean history
- main/master: Production-ready
- develop: Integration branch
- feature/*: New features
- fix/*: Bug fixes
- hotfix/*: Emergency fixes
- Undo changes: git reset, git revert, git restore
- Stash work: git stash save/pop/apply
- Interactive rebase: git rebase -i
- Cherry-pick commits: git cherry-pick
- Resolve merge conflicts
- Recover lost commits (git reflog)
- Fix detached HEAD
- Clean up branches
- Never force push to shared branches
- Use .gitignore properly
- Sign commits (GPG)
- Regular garbage collection


## Examples

Add examples of how to use this skill here.

## Notes

- This skill was auto-generated
- Edit this file to customize behavior

Overview

This skill provides expert, practical guidance for Git workflows, troubleshooting, and best practices to keep repositories clean and collaboration smooth. It focuses on actionable commands, branching conventions, conflict resolution, and recovery techniques that fit teams and solo developers. Use it to learn safe habits and resolve common Git pain points quickly.

How this skill works

The skill inspects your described Git scenario and recommends concrete commands and steps—such as branching strategies, rebase vs merge decisions, stash usage, and recovery flows. It explains when to use commands like git reset, git revert, git restore, git rebase -i, git cherry-pick, and git reflog, and highlights safety measures like avoiding force-pushes to shared branches. For merge conflicts or detached HEAD states, it gives step-by-step resolution and recovery guidance.

When to use it

  • Setting up a consistent branching model (main, develop, feature/*, fix/*, hotfix/*).
  • Cleaning up commit history before merging or opening a pull request.
  • Recovering lost work after accidental resets, detached HEAD, or mistaken force-pushes.
  • Resolving merge conflicts and performing interactive rebases safely.
  • Preparing a repository for shared collaboration or continuous deployment.

Best practices

  • Commit early and often with clear, imperative messages (e.g., "Add user login").
  • Use short-lived feature branches and rebase onto develop/main before merging to keep history linear.
  • Never force-push to shared branches; use force-push only for private branches after explicit team agreement.
  • Use .gitignore for generated files and sign important commits with GPG if authenticity matters.
  • Use git stash to save in-progress work, and git reflog to find and recover lost commits.

Example use cases

  • I started an interactive rebase to squash commits and hit conflicts—step-by-step conflict resolution and continuation commands.
  • Recovering a commit after an accidental git reset --hard using git reflog and git cherry-pick.
  • Preparing a feature branch for merge: rebase onto develop, run tests, and push without force.
  • Handling a detached HEAD by creating a branch from the current commit and reintegrating work.
  • Cleaning up stale branches locally and remotely, pruning merged branches safely.

FAQ

When should I use rebase vs merge?

Use rebase to keep a linear history for feature branches before merging; use merge to preserve a record of branch integration in release or long-lived branches.

How do I safely undo a public commit?

Avoid rewriting published history. Use git revert to create a new commit that undoes changes instead of reset or force-push.