Categories
Tags
Astro Automation Camping changelog clear CLI Codex compact Component Design Configuration context Context Copilot copy Ctrl+S CUDA Cursor Day Trip delegate diff Dynamic Routing Editor Error Error Fix Error Handling experimental Gemini git GitHub GitHub Copilot Google Hiking Hot Springs init Installation Iwate Prefecture Kobe Linux Mac Mention Meteor Shower Mode Switching model Nara Prefecture NoAdapterInstalled Node.js nvm OpenAI params plan PowerShell Prompt props Public Key Authentication Python Redirect research rewind SEO share Shell Execution Shift+Tab Shortcut SSH SSH config ssh-copy-id Stargazing Static Site streamer-mode Student undo Update usage Visual Studio VS Code VS2026 Windows WSL
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 functionYou can also mention folders:
/copilot> @src/components/ refactor these componentsWhen to Use It
| Scenario | Example |
|---|---|
| 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.
Related Posts
How to Add Files to Context in GitHub Copilot CLI【@】
https://naonao-na.com/en/posts/github-copilot-cli-mention-files/
