Answer: To use a chat variable, type # in the chat prompt box, followed by a chat variable. For example, #file includes the current file's content in the prompt, and #selection includes the currently selected text in the prompt. Status: Confirmed Entry: tool/github-copilot/commands-and-shortcuts/copilot-chat-variables Revision: 3 Digest: sha256:742cfb1631816989 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:31:14Z Last changed: 2026-11-18T13:08:24Z (How to use: — → #) Last verified: 2026-11-20T13:12:32Z Next check: 2026-11-21T13:12:32Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of How to use | # | [1] | 2026-11-20 #file | #file | [1] | 2026-11-20 #selection | #selection | [1] | 2026-11-20 Sources: [1] GitHub. "GitHub Copilot Chat cheat sheet - GitHub Docs". https://docs.github.com/en/copilot/reference/chat-cheat-sheet Role: primary. Accessed: 2026-11-20T13:12:32Z Quote: "To use a chat variable, type # in the chat prompt box, followed by a chat variable." (Supports: How to use) Quote: "#file Includes the current file's content in the prompt." (Supports: #file) Quote: "#selection Includes the currently selected text in the prompt." (Supports: #selection) Snapshot SHA-256: de594b9bb710b1d422d2f1d470019da71bfa03f310df9c38ba90dd431ac5c437 (captured 2026-11-18T13:08:23Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T13:08:24Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:12:32Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:12:32Z Last attempt: 2026-11-20T13:12:32Z Notes and limitations: Extracted automatically from a single official source (section "Chat variables"). Related: https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-cli-global-shortcuts Which keyboard shortcuts are available in the GitHub Copilot CLI interactive interface? https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-cli-login-options How do I log in to GitHub Copilot CLI using the copilot login command? https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-cli-slash-commands Which slash commands can I use in the GitHub Copilot CLI interactive interface? https://latestn.com/tool/github-copilot/commands-and-shortcuts/cli-shortcuts What keyboard shortcuts does GitHub Copilot CLI support? https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-chat-participants How do I mention a chat participant like @workspace in GitHub Copilot Chat? https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-chat-slash-commands What slash commands are available in GitHub Copilot Chat? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T13:08:24Z | changed | How to use: — → # | [1] 2026-11-18T13:08:24Z | changed | How to use a chat variable: # → — | [1] 2026-11-16T12:56:40Z | changed | #selection: — → #selection | [1] 2026-11-16T12:56:40Z | changed | #file: — → #file | [1] 2026-11-16T12:56:40Z | changed | How to use a chat variable: — → # | [1] 2026-11-16T12:56:40Z | changed | #selection description: Includes the currently selected text in the prompt. → — | [1] 2026-11-16T12:56:40Z | changed | #file description: Includes the current file's content in the prompt. → — | [1] 2026-11-16T12:56:40Z | changed | usage instruction: # → — | [1] 2026-11-13T03:31:14Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-chat-variables/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/github-copilot/commands-and-shortcuts/copilot-chat-variables POST: https://latestn.com/dispute/tool/github-copilot/commands-and-shortcuts/copilot-chat-variables with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/commands-and-shortcuts/copilot-chat-variables?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I use chat variables like #file or #selection in GitHub Copilot Chat? Revision 3, last verified 2026-11-20T13:12:32Z. https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-chat-variables (accessed 2026-11-21T09:57:40Z). @misc{LatestN_tool_github_copilot_commands_and_shortcuts_copilot_chat_variables_r3, title = {How do I use chat variables like #file or #selection in GitHub Copilot Chat?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-chat-variables}}, note = {Revision 3; digest sha256:742cfb1631816989; last verified 2026-11-20T13:12:32Z; accessed 2026-11-21T09:57:40Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/github-copilot/commands-and-shortcuts/copilot-chat-variables