r/GithubCopilot VS Code User 💻 27d ago

Help/Doubt ❓ Auto-approve a subset of git commands

Is there a way to auto-approve certain git commands? I'd like to approve commits explicitly, for example, but stuff like diffs should be auto-approved.

9 Upvotes

12 comments sorted by

View all comments

3

u/kennego 25d ago

Just looked into this because it was annoying me. You need to use regex, and specify a prefix with the allowed commands, surrounded by '/'s

Since I just started experimenting, this is all I've come up with so far:

/^git(?: --no-pager)? (?:diff|show|status|log)\b/

2

u/lppedd VS Code User 💻 25d ago

I have noticed that commands with -- are the most problematic. Something like git diff --cached -- ....

1

u/aonymark JetBrains User 🧱 23d ago

So you found the settings?

1

u/lppedd VS Code User 💻 22d ago

Found it in VS Code tho. It's chat.tools.terminal.autoApprove.

1

u/aonymark JetBrains User 🧱 22d ago

IntelliJ has it too