Git Workflow
Help with Git operations and workflow strategy.
Branch Strategy
# Inspect current state
git branch -a
git log --oneline -20
git status
Recommend strategy based on project context:
- Solo:
main+ short-lived feature branches - Team:
main+develop+feature/*/fix/*branches - Release cadence: GitFlow (
main/develop/release/*/hotfix/*)
PR / MR Workflow
git diff main --stat— review what changed- Draft a clear title and description
- Suggest reviewers based on touched files:
git log --format='%an' -- <files> - Always include the full PR/MR URL in any summary or status update:
Retrieve with:PR: https://github.com/owner/repo/pull/42gh pr view --json url --jq .url(GitHub) orglab mr view --output json | jq .web_url(GitLab)
Conflict Resolution
git diff --name-only --diff-filter=U— find conflicted files- Read each conflicted file
- Understand both sides of the conflict
- Resolve with minimal changes, preserving intent from both sides
Interactive Rebase
Guide through git rebase -i for cleaning history before a PR.
If resolving conflicts during rebase, continue non-interactively:
GIT_EDITOR=true git rebase --continue
Non-Interactive Safety
When the agent runs git or gh/glab, never open an interactive editor or prompt.
Commits — always pass message on the command line:
git commit -m "fix(scope): message"
Rebase continue — --no-edit is not supported, use:
GIT_EDITOR=true git rebase --continue
# or
git -c core.editor=true rebase --continue
Merge — reuse existing message:
git merge --no-edit
Any other git command that could open an editor:
GIT_EDITOR=true git <command>
GitHub CLI — disable prompts and provide all fields explicitly:
GH_PROMPT_DISABLED=1 gh pr create --title "..." --body "..."
GH_PROMPT_DISABLED=1 gh pr merge --squash --delete-branch
GitLab CLI — same principle:
glab mr create --title "..." --description "..." --yes
glab mr merge --yes
Only allow interactive editors or prompts when the user explicitly asks for them.
Source: aretw0/agents-lab — distributed by TomeVault.