github

GitHub Copilot CLI for Beginners: Interactive v. non-interactive mode (opens in new tab)

GitHub Copilot CLI offers two ways to work from the terminal: interactive mode for ongoing, collaborative sessions and non-interactive mode for quick, one-off prompts. The article recommends choosing between them based on whether you need iterative exploration or a fast answer within an existing shell workflow. Previous sessions can also be resumed in either mode.

Interactive Mode for Collaborative Work

  • Start it by running copilot.
  • It is the default mode and provides a chat-like, back-and-forth experience.
  • Users can:
    • Ask questions about a project.
    • Review Copilot’s responses.
    • Ask follow-up questions.
    • Request actions, such as running a local server.
  • Copilot may request permission to trust the current folder because it needs to read or modify project files.
  • This mode is best for exploratory coding, troubleshooting, and tasks that require multiple steps.

Non-Interactive Mode for Quick Prompts

  • Start it with copilot -p "your prompt".
  • It produces a single response without opening a full conversational session.
  • Typical uses include:
    • Summarizing a repository.
    • Generating code snippets.
    • Running Copilot inside automated workflows.
  • It is designed to keep users in their normal terminal flow and is most useful when the required task is clear and narrowly defined.

Resuming Previous Sessions

  • In interactive mode, enter /resume to select a previous session.
  • From the regular shell, use copilot --resume to open the session picker directly.
  • Resuming preserves the context of earlier conversations, making it easier to continue unfinished work.

The practical choice is simple: use interactive mode for deeper, iterative collaboration and non-interactive mode for focused, one-shot requests.