一键导入
git-workflow
Git workflow assistant for branching, commits, PRs, and conflict resolution. Use when user asks about git strategy, branch management, or PR workflow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Git workflow assistant for branching, commits, PRs, and conflict resolution. Use when user asks about git strategy, branch management, or PR workflow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Working in the ifiokjr/dotfiles ecosystem. Use when commands need secrets, shell aliases, devenv, the dot/dotfiles CLI, rebuild, deployment, or any task that runs inside this dotfiles-managed environment. Teaches agents how to use the shortcuts, secrets workflow, and tooling available on these machines.
Use devenv as the task runner and development environment when devenv.nix is present in the project. Run scripts via `devenv test` to enter the shell, or `devenv shell <command>` when commands aren't available outside the shell. Prefer devenv scripts over ad-hoc commands. Use when devenv.nix exists, or when the user asks about devenv setup, scripts, processes, or Nix-based dev environments.
基于 SOC 职业分类
| name | git-workflow |
| description | Git workflow assistant for branching, commits, PRs, and conflict resolution. Use when user asks about git strategy, branch management, or PR workflow. |
Help with Git operations and workflow best practices.
Make small, frequent commits rather than accumulating large batches of changes.
git commit -m "wip: <description>" over leaving work uncommitted for long stretchesgit stash instead of discardingWhen you need to clear or reset uncommitted work, never just delete it — stash it with an explanation.
git stash push -m "<reason>: <description>" to preserve work and record why it was stashedgit stash list or git refloggit stash drop <stash>Example:
# Bad: work is just gone
rm -rf changed-files/
git checkout -- .
# Good: work is preserved with context
git stash push -m "pivot: abandoning approach A for approach B after benchmark regression"
git stash push -m "interrupted: switching to urgent bugfix PR #123"
Start new work in a fresh worktree rather than working directly on main or the current branch.
git worktree add -b feat/description ../worktrees/feat-descriptionmain clean and available for quick reference, hotfixes, or parallel reviewsgit worktree remove <path> — the branch remains for PR/mergegit worktree commandsNever merge or push to origin while wip: commits remain in the stack, unless the user explicitly says otherwise.
wip: commits using interactive rebase: git rebase -i mainwip: commits to proper Conventional Commit messages that describe the final intentwip: commits to origin if the user explicitly requests it (e.g. "just push what I have")Example — cleaning up before a PR:
# Check what's in the stack
git log --oneline main..HEAD
# If there are wip: commits, restructure
git rebase -i main
# pick feat(widget): add new rendering pipeline
# squash wip: failing test for edge case
# squash wip: fix off-by-one in renderer
# pick perf(widget): cache computed layout
# drop wip: try alternative approach (abandoned)
# Push the cleaned branch
git push origin feat/widget-rendering
See also Core Principle #1: Commit early and often — commit freely with wip: during development, but clean up before sharing.
# Check current state
git branch -a
git log --oneline -20
git status
Recommend branching strategy based on project:
When the repository uses git worktrees, do not assume the current checkout is the main repo root. First establish:
git rev-parse --show-toplevel
git rev-parse --git-common-dir
git worktree list --porcelain
Prefer worktrees for all new work. See Core Principle #3: Use worktrees for new work.
If the oh-pi worktree extension is available, prefer:
/worktree status or git rev-parse --show-toplevel — show the current worktree and repo root/worktree list or git worktree list --porcelain — show all repo worktreesFor pi-owned worktrees:
When finishing work in a worktree:
git push origin <branch>git worktree remove <path>Follow Conventional Commits
Small commits are better than perfect commits. See Core Principle #1: Commit early and often.
Use these prefixes:
feat(scope): add new feature
fix(scope): fix bug description
refactor(scope): restructure code
docs(scope): update documentation
test(scope): add/update tests
chore(scope): maintenance tasks
For work-in-progress commits (which are encouraged!), use wip: prefix or chore(wip)::
git commit -am "wip: explore trie-based approach for tokenization"
git commit -am "wip: failing test for edge case in parser"
git commit -am "wip: checkpoint before attempting refactor"
Clean up before opening a PR:
git rebase -i main # squash related wip commits
But never leave work uncommitted for long — stash or commit, don't let it sit dirty.
git diff main --stat — Review changesgit log --format='%an' -- <files>)When a PR has been opened, always include the full GitHub PR URL in any summary or status update you provide. This makes it easy for the user to click through to the PR directly.
Example summary format:
PR: https://github.com/owner/repo/pull/42
Use gh pr view --json url --jq .url to retrieve the URL if you do not already have it.
When the agent runs git or gh, avoid opening an interactive editor or prompt.
A lot of Git entrypoints use different editor config keys, so avoid surprises by disabling both:
core.editor / GIT_EDITOR (commit, merge, tag message editing)sequence.editor / GIT_SEQUENCE_EDITOR (interactive rebase todo-list editing)Use this pattern for non-interactive flows:
GIT_EDITOR=true GIT_SEQUENCE_EDITOR=true git -c core.editor=true -c sequence.editor=true rebase --continue
git commit -m "fix(scope): message"
git merge --no-edit
GIT_EDITOR=true and GIT_SEQUENCE_EDITOR=true (plus -c core.editor=true -c sequence.editor=true) for that invocation.GH_PROMPT_DISABLED=1 gh pr create --title "..." --body "..."
GH_PROMPT_DISABLED=1 gh pr merge --squash --delete-branch
git diff --name-only --diff-filter=U — Find conflicted filesGuide through git rebase -i for cleaning up history before PR.
If the agent is resolving conflicts during a rebase, continue with a non-interactive command such as:
GIT_EDITOR=true GIT_SEQUENCE_EDITOR=true git -c core.editor=true -c sequence.editor=true rebase --continue