Skip to content

Instantly share code, notes, and snippets.

@chadhs
Created March 5, 2026 14:21
Show Gist options
  • Select an option

  • Save chadhs/f258c3967d60edb903cfcad82a8fa232 to your computer and use it in GitHub Desktop.

Select an option

Save chadhs/f258c3967d60edb903cfcad82a8fa232 to your computer and use it in GitHub Desktop.

OpenCode: Keep Git Operations Manual

By default, AI agents in OpenCode may run git commands (add, commit, push, etc.) on your behalf. If you prefer to handle all git operations yourself, you can add a global rule to prevent this.

Setup

Create the file ~/.config/opencode/AGENTS.md with the following contents:

# Personal Workflow Preferences

## Git Operations
Do not run git commands (add, commit, push, pull, merge, rebase, etc.) unless I explicitly ask for help with git. I handle all git operations myself.

This file is loaded into every OpenCode session across all projects. It is not committed to any repo — it's your personal config.

You can add additional personal preferences to this file at any time.

How it works

OpenCode supports rules via AGENTS.md files at two levels:

  • Global~/.config/opencode/AGENTS.md — applies to all projects, personal to you
  • ProjectAGENTS.md in a project root — applies to that project, shared with your team via git

Global rules are always loaded. See the OpenCode rules docs for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment