Agent Git Workflow
A practical OpenClaw skill for shipping code through GitHub pull requests with consistent branch naming, clean commits, and reliable review loops.
Branch ownership naming
Section titled “Branch ownership naming”Use branch names that make ownership and intent obvious:
- Pattern:
<owner>/<scope>-<change> - Example:
obrera/skills-agent-git-workflow
This helps reviewers immediately see who owns the branch and what the change is about.
Note on
obrera:obrerais an example GitHub handle prefix. Replace it with your own.
One PR / one commit discipline
Section titled “One PR / one commit discipline”Default to one focused commit per pull request:
- Keep scope tight (single feature/fix/docs unit)
- Make one clean commit with a clear message
- Open one PR for that commit
Why this works:
- Faster review and lower cognitive load
- Easier revert if needed
- Cleaner project history
PR hygiene + self-review
Section titled “PR hygiene + self-review”Before requesting review:
- Rebase your branch onto
mainand resolve conflicts locally - Self-review the full diff in GitHub (files changed + rendered docs/screenshots)
- Check PR metadata:
- clear title
- concise description (what changed, why, risk)
- test/build notes
- Remove noise (debug logs, unrelated formatting, accidental file changes)
Review loop
Section titled “Review loop”Treat review as a tight operational loop:
- Fetch review comments via API/CLI (review + inline threads)
- Apply requested fixes in the same branch as new commits (consider
git commit --fixupfor easier squashing later; these can be squashed on merge; no amend/force-push required) - Reply to each comment with what changed
- Resolve completed threads
- Request re-review
Repeat until all blocking feedback is cleared.
CI gates, merge strategy, and cleanup
Section titled “CI gates, merge strategy, and cleanup”CI gates
Section titled “CI gates”Merge only when required checks are green and branch protection rules are satisfied.
Merge strategy
Section titled “Merge strategy”Prefer squash merge for this workflow to preserve one-PR/one-commit history in main.
Post-merge cleanup
Section titled “Post-merge cleanup”After merge:
- Delete remote branch
- Delete local branch
- Pull latest
main - Confirm follow-up tasks (if any) are tracked separately