Git Commands
Explore 7 curated git commands for building with AI coding agents — what each one does, when to use it, and how to add it to your workflow.
Seven slash commands for everyday Git work in Claude Code. /commit stages changes and writes a Conventional Commits message. /create-pr pushes the branch and opens a GitHub pull request with a generated title and body. /sync-branch fetches and rebases onto the base branch, resolving conflicts and checking the build, and /resolve-conflict works through a merge, rebase or cherry-pick conflict by reading both sides before it continues.
The other three are for when something has gone wrong. /git-undo picks the right way to reverse the last operation (restore, a soft or mixed reset, revert, or reflog recovery) depending on whether it was already pushed, and asks before anything destructive. /git-bisect drives git bisect to find the commit that introduced a regression. /clean-branches lists merged and stale branches for review, then deletes them with the safe -d option.
7 commands
Clean Branches
Safely prune merged and stale Git branches: drop dead remote-tracking refs, list merged candidates for review, then delete with the safe -d variant.
Create PR
Push the current branch and open a GitHub pull request with a generated title and body.
Git Bisect
Drive git bisect to find the exact commit that introduced a regression.
Git Undo
Safely reverse the last Git operation in the current repo — pick the right tool (restore, reset --soft/--mixed, revert, or reflog recovery) based on what happened and whether it was already pushed, and confirm before anything destructive.
Resolve Merge Conflicts
Walk through resolving the in-progress merge, rebase, or cherry-pick conflict in the current repo by understanding both sides, then verify before continuing.
Sync Branch
Fetch and rebase the current branch onto its base, resolving conflicts and verifying the build.