agentleFS
fabioc-alohafabioc-aloha/Alex_ACT_Edition/.github/skills/git-workflow/SKILL.md

git-workflow

Skill0 starsChanged 4 months agoMITView on GitHub

Apply consistent git practices for branch hygiene, safe commits, and recovery from common mishaps (lost commits, bad merges, accidental pushes). Use when authoring or reviewing a git workflow, recovering broken local state, or sequencing a commit/push that needs explicit user approval before destructive steps.

  • Reads credentials
  • Deletes or force-pushes
  • Commits and pushes

188 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use squad-commands, ci-cd-pipelines and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Microsoft AzureSkill

    squad-commands

    Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.

    Also in 5 projects that use this

  • harrissohail6Skill

    ci-cd-pipelines

    CI/CD pipeline design and implementation. Auto-activates when discussing deployment, automation, or pipelines.

    Also in 6 projects that use this

  • Microsoft AzureSkill

    architectural-proposals

    How to write comprehensive architectural proposals that drive alignment before code is written

    Also in 4 projects that use this

  • GitHubSkill

    e2e-template-testing

    End-to-end validation of coordinator and agent template changes

    Also in 3 projects that use this

  • GitHubSkill

    notification-routing

    Route agent notifications to specific channels by type — prevent alert fatigue from single-channel flooding

    Also in 3 projects that use this

  • frostneySkill

    native-nostalgia-stack

    Applies the user's FreePascal toolchain and its build, formatting, hook, and test contracts while leaving project-specific mechanics local. Use when scaffolding or working in a FreePascal project that follows this toolchain.

    Also in 3 projects that use this

  • +5 more from Azure
  • +1 more from github

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 165 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Delete branches after merge

    line 123
  2. Distinctive:

    Check Agent Sessions view to see which worktree an agent is using

    line 160

“Common” is measured: kept by at least 6 in 10 of the 165 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git Workflow Skill

Consistent git practices, recovery patterns, and safe operations.

⚠️ Staleness Warning

Git core is stable, but GitHub features (Actions, CLI, Copilot integration) evolve.

Refresh triggers:

  • GitHub CLI major updates
  • GitHub Actions runner changes
  • New git features (e.g., git switch, git restore)
  • GitHub Copilot CLI integration

Last validated: May 2026 (Git 2.45+, GitHub CLI 2.x)

Check current state: Git Release Notes, GitHub CLI


Decision Table

ScenarioCommandNotes
Undo last commit, keep changesgit reset --soft HEAD~1Safe, preserves work
Restore single filegit checkout HEAD -- path/to/fileDiscards file changes
Restore entire foldergit checkout HEAD -- .github/Discards folder changes
Before risky operationgit add -A; git commit -m "checkpoint"Always checkpoint first
Discard all uncommittedgit reset --hard HEADDestructive, no recovery
Reset to remote stategit reset --hard origin/mainDestructive, syncs to remote
Save work temporarilygit stash → git stash popFor quick context switch
Isolated experimental workgit worktree add ../feature branchAgent-friendly isolation

Commit Message Convention

type(scope): brief description

- Detail 1
- Detail 2

Types: feat, fix, refactor, docs, chore, test, style

Examples:

feat(skills): add git-workflow skill
fix(sync): resolve race condition in background sync
refactor(skills): migrate domain-knowledge to skills architecture
docs(readme): update installation instructions
chore(deps): bump typescript to 5.3

Before Risky Operations

# ALWAYS commit before risky operations
git add -A; git commit -m "checkpoint: before [risky thing]"

# For extra safety, tag it
git tag "safe-point-$(date +%Y-%m-%d-%H%M)"

Recovery Patterns

Undo Last Commit (keep changes)

git reset --soft HEAD~1

Restore Single File

git checkout HEAD -- path/to/file

Restore Folder

git checkout HEAD -- .github/

Hard Reset to Known Good State

git reset --hard HEAD           # Discard all uncommitted changes
git reset --hard origin/main    # Reset to remote state
git reset --hard <tag-name>     # Reset to tagged state

Find Last Good Commit

git log --oneline -20           # Recent history
git log --oneline .github/ -10  # History for specific folder

Branching Strategy

main
 └── feature/short-description
 └── fix/issue-number
 └── release/v3.7.0

Rules:

  • main is always deployable
  • Feature branches for experimental work
  • Merge via PR when possible, direct commit for small fixes
  • Delete branches after merge

Conflict Resolution

  1. Pull before push: git pull --rebase origin main
  2. If conflicts: Resolve in editor, then git add . + git rebase --continue
  3. If stuck: git rebase --abort to start over

Stashing

git stash                       # Save work-in-progress
git stash pop                   # Restore and delete stash
git stash list                  # See all stashes
git stash drop                  # Delete top stash

Worktrees (Agent Isolation)

VS Code background agents use git worktree to isolate changes. Understanding worktrees is useful when debugging agent sessions.

# Create a worktree for isolated work
git worktree add ../project-feature feature-branch

# List all worktrees
git worktree list

# Remove a worktree (prune stale links)
git worktree remove ../project-feature
git worktree prune

VS Code integration (1.109+):

  • git.worktreeIncludeFiles — copy gitignored files (e.g., .env) into agent worktrees
  • Background agents auto-commit at end of each turn within their worktree
  • Check Agent Sessions view to see which worktree an agent is using

Anti-Patterns

  • ❌ git push --force on shared branches
  • ❌ Committing secrets or credentials
  • ❌ Giant commits with unrelated changes
  • ❌ Vague messages like "fix stuff" or "update"

Would Revise If

Revise if the recovery patterns produce data loss in a real recovery scenario, or if the 'safe operations' classification labels a destructive op as safe and that op runs without confirmation.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.