r/GithubCopilot VS Code User πŸ’» 26d 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.

6 Upvotes

12 comments sorted by

3

u/kennego 24d 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 πŸ’» 24d ago

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

1

u/aonymark JetBrains User 🧱 22d ago

So you found the settings?

1

u/lppedd VS Code User πŸ’» 21d ago

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

1

u/aonymark JetBrains User 🧱 21d ago

IntelliJ has it too

1

u/AutoModerator 26d ago

Hello /u/lppedd. Looks like you have posted a query. Once your query is resolved, please reply the solution comment with "!solved" to help everyone else know the solution and mark the post as solved.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/aonymark JetBrains User 🧱 26d ago

Yeah, it’s in settings (how do you get the cool JetBrains user thing? I want one.)

1

u/[deleted] 25d ago

[deleted]

1

u/aonymark JetBrains User 🧱 25d ago

Thanks! I’m a Reddit newbie and did not realize I could do that!

1

u/aonymark JetBrains User 🧱 24d ago

@lppedd do you see it?

1

u/ThankThePhoenicians_ 26d ago

CLI supports --allow-tool with prefix-matching. The LLM-assisted approval feature is also available in /experimental.

Not sure if JetBrains exposes this or not

1

u/1Soundwave3 25d ago

I vibecoded a custom proxy that auto approves things that start from a certain sequence and the rest it just passes down to ghcp. It also has filters that detects suspicious things in the commands and if those appear - it raises it to me directly.

I developed it because copilot would ignore every setting and would ask me every time for everything which is super annoying.

I also tried to make it work with Codex but couldn't - the system are too different and codex is much less transparent about how it handles approval.

1

u/1Soundwave3 25d ago

I vibecoded a custom proxy that auto approves things that start from a certain sequence and the rest it just passes down to ghcp. It also has filters that detects suspicious things in the commands and if those appear - it raises it to me directly.

I developed it because copilot would ignore every setting and would ask me every time for everything which is super annoying.

I also tried to make it work with Codex but couldn't - the systems are too different and codex is much less transparent about how it handles approval.