Summarize a file from the command line
Run Copilot non-interactively with a prompt.
copilot -p "Summarize what this file does: ./README.md"The `-p` flag lets you run one prompt and exit without opening the full interface.
Commands and prompt patterns for interactive use, one-shot prompts, file-aware context, and common terminal Copilot workflows.
Use Copilot as a terminal chat or as a single-command assistant.
Run Copilot non-interactively with a prompt.
copilot -p "Summarize what this file does: ./README.md"The `-p` flag lets you run one prompt and exit without opening the full interface.
Ask Copilot to explain a code file directly from the terminal.
copilot -p "Explain this file: ./complex.ts"A strong workflow for quick code comprehension.
echo "Explain this file: ./complex.ts" | copilotUseful in scripts or shell pipelines. If you also pass `-p`, the piped input is ignored.
Get a concise terminal answer about a shell task.
copilot -p "In Git, how can I apply a commit from another branch"This is a high-traffic style query for a cheatsheet audience.
Use Copilot to plan work before making changes.
copilot -p "Plan a safe refactor of this module and list the files you would inspect first."Works well before delegating edits in a larger repository.
copilot -p "Summarize the intent of the last 10 commits in this repository."Helpful for release notes, standups, and onboarding.
Use file injection and local shell escapes to work faster in interactive mode.
Reference a file inline inside the interactive UI.
@ README.mdType `@` followed by a file name to include that file's contents in the current prompt context.
Execute a local shell command directly from the session.
! git statusUseful for checking repo state while staying inside the interactive workflow.
Open the current prompt in your configured editor.
Ctrl+GGreat for long prompts, multi-step instructions, or reusable templates.
Ctrl+LHandy when a session has accumulated a lot of scrollback.
Stop the current task or prompt execution.
EscA fast way to back out when Copilot starts the wrong action.
Ctrl+DUse twice-pressed `Ctrl+C` or `Ctrl+D` depending on the situation and shell.
Practical prompt patterns for code understanding, debugging, and repo work.
Describe the failure and let Copilot inspect the repo.
copilot -p "A test is failing after the last merge. Inspect the codebase, identify the likely cause, and propose the smallest safe fix."A practical starting point for debugging flows.
Ask for a small feature implementation plan and changes.
copilot -p "Add a health check endpoint to this app and explain which files need to change."Useful before moving into a longer interactive session.
copilot -p "Document the public API and side effects of this module in concise Markdown."Strong for maintainability and SEO-oriented docs generation.
Ask for a human-readable review of local modifications.
copilot -p "Review the changes in this working tree and flag risky edits or missing tests."Good before committing or opening a pull request.
Ask Copilot for an architecture tour.
copilot -p "Give me a quick onboarding guide to this repository: main entry points, architecture, setup commands, and important directories."A high-value workflow for new team members.