135 words
1 minutes
How to Add Files to Context in GitHub Copilot CLI【@】

Overview#

Ever told Copilot “fix this file” and it started talking about a completely different file?

Copilot doesn’t always know which file you mean. Use @ to explicitly point it to the right one.


Usage#

Type @ followed by a file path in your prompt:

/copilot> @src/auth/login.ts add validation to this function

You can also mention folders:

/copilot> @src/components/ refactor these components

When to Use It#

ScenarioExample
Target a specific file@package.json update dependencies
Reference multiple files@src/api.ts @src/types.ts check type consistency
Work on a whole folder@tests/ add missing test cases

What Happens Without @?#

Without @, Copilot explores the file system on its own to find relevant files. It usually gets it right, but sometimes picks the wrong one.

When you need Copilot to look at a specific file, @ removes the guesswork.


How to Add Files to Context in GitHub Copilot CLI【@】
https://naonao-na.com/en/posts/github-copilot-cli-mention-files/
Author
[object Object]
Published at
2026-03-28