AI / GitHub Copilot CLI Fundamentals Interview Questions
How do you start an interactive Copilot CLI session and what are the two main usage modes?
Copilot CLI has two usage modes: an interactive session (the default) and a non-interactive / programmatic mode using the -p flag.
# Mode 1: Interactive session cd my-project copilot # → trust prompt → REPL-style interface opens # Type prompts, use slash commands, use keyboard shortcuts # Mode 2: Non-interactive / single prompt copilot -p "How do I undo a git commit without losing changes?" # → prints the answer and exits # Mode 2 with silent output (response only, no extra info) copilot -p "Explain git rebase" -s # Use -p in scripts for AI-powered automation SUMMARY=$(copilot -p "Summarise the changes in git diff HEAD~1" -s) echo "$SUMMARY"
| Mode | Command | Use case |
|---|---|---|
| Interactive | copilot | Ongoing coding sessions, multi-turn conversations, task execution |
| Non-interactive | copilot -p "prompt" | Scripts, automation, one-off questions, CI/CD integration |
| Silent non-interactive | copilot -p "prompt" -s | Capture only the AI response in a shell variable |
Inside an interactive session: you can type natural language prompts, use slash commands (e.g. /help, /model, /pr), use keyboard shortcuts (e.g. Shift+Tab to cycle between modes), and browse GitHub tabs - all without leaving the terminal.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
