Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "git",
"version": "1.2.0",
"version": "1.3.0",
"description": "Dynamic git instructions via SessionStart hook with mainline detection, conventional commits, fork handling, and safety guardrails",
"author": {
"name": "cblecker",
Expand Down
1 change: 1 addition & 0 deletions git/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ contextually.
- Claude Code attribution line removed from PR body template
- Assisted-by trailer used instead of Co-Authored-By (follows Linux kernel AI attribution standard)
- Signed-off-by safety rule added (AI must never add DCO sign-off)
- "NEVER commit directly to mainline" safety rule added (upstream has no equivalent)

## Maintenance

Expand Down
14 changes: 8 additions & 6 deletions git/scripts/git-instructions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ IMPORTANT: If you can see duplicate git instructions in your context (e.g. both

Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:

You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. The numbered steps below indicate which commands should be batched in parallel.

Git Safety Protocol:
- NEVER update the git config
- NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions. Taking unauthorized destructive actions is unhelpful and can result in lost work, so it's best to ONLY run these commands when given direct instructions
Expand All @@ -181,7 +183,7 @@ Git Safety Protocol:
- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive
- NEVER add Signed-off-by tags to commits. If asked to do so, abort the request and let the user know. Only humans can certify the Developer Certificate of Origin (DCO). The human submitter is responsible for adding their own Signed-off-by tag.

1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel, each using the Bash tool:
1. Run the following bash commands in parallel, each using the Bash tool:
- Run a git status command to see all untracked files. IMPORTANT: Never use the -uall flag as it can cause memory issues on large repos.
- Run a git diff command to see both staged and unstaged changes that will be committed.
- Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
Expand All @@ -190,7 +192,7 @@ Git Safety Protocol:
- Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
- Ensure it accurately reflects the changes and their purpose
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands:
3. Run the following commands in parallel:
- Add relevant untracked files to the staging area.
- Create the commit with a message ending with the Assisted-by trailer, in the format \`Assisted-by: Claude:<your-model-id>\` where you substitute your actual model identifier (e.g. claude-opus-4-6).
- Run git status after the commit completes to verify success.
Expand All @@ -199,7 +201,7 @@ Git Safety Protocol:

Important notes:
- NEVER run additional commands to read or explore code, besides git bash commands
- NEVER use the TodoWrite or Agent tools
- NEVER use the TaskCreate, TaskUpdate, or Agent tools
- DO NOT push to the remote repository unless the user explicitly asks you to do so
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
- IMPORTANT: Do not use --no-edit with git rebase commands, as the --no-edit flag is not a valid option for git rebase.
Expand All @@ -219,15 +221,15 @@ ${CONVENTIONAL_SECTION}

IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:

1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from ${MAINLINE}:
1. Run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from ${MAINLINE}:
- Run a git status command to see all untracked files (never use -uall flag)
- Run a git diff command to see both staged and unstaged changes that will be committed
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
- Run a git log command and \`git diff ${MAINLINE}...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch)
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request title and summary:
- Keep the PR title short (under 70 characters)
- Use the description/body for details, not the title
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel:
3. Run the following commands in parallel:
- Create new branch if needed (if on ${MAINLINE}, create a feature branch first)
- Push to remote with -u flag if needed
- Create PR using GitHub MCP tools (mcp__plugin_github_github__create_pull_request) with: owner, repo, title, head, base (${MAINLINE}), body
Expand All @@ -241,7 +243,7 @@ IMPORTANT: When the user asks you to create a pull request, follow these steps c
</example>

Important:
- DO NOT use the TodoWrite or Agent tools
- DO NOT use the TaskCreate, TaskUpdate, or Agent tools
- Return the PR URL when you're done, so the user can see it
${FORK_SECTION}
# Branch workflow
Expand Down
Loading