diff --git a/website/src/content/docs/learning-hub/cli-for-beginners/01-setup-and-first-steps.md b/website/src/content/docs/learning-hub/cli-for-beginners/01-setup-and-first-steps.md index 42cce797..6e4dd018 100644 --- a/website/src/content/docs/learning-hub/cli-for-beginners/01-setup-and-first-steps.md +++ b/website/src/content/docs/learning-hub/cli-for-beginners/01-setup-and-first-steps.md @@ -3,7 +3,7 @@ title: '01 ยท First Steps' description: 'Experience your first GitHub Copilot CLI demos and learn the three main interaction modes.' authors: - GitHub Copilot Learning Hub Team -lastUpdated: 2026-03-20 +lastUpdated: 2026-05-01 --- ![Chapter 01: First Steps](/images/learning-hub/copilot-cli-for-beginners/01/chapter-header.png) @@ -365,17 +365,22 @@ copilot --allow-all -p "Review @myfile.py for issues" ## Essential Slash Commands -These commands work in interactive mode. **Start with just these six** - they cover 90% of daily use: +These commands are great to learn initially as you're getting started with Copilot CLI: | Command | What It Does | When to Use | |---------|--------------|-------------| -| `/help` | Show all available commands | When you forget a command | +| `/ask` | Ask a quick question without it affecting your conversation history | When you want a quick answer without derailing your current task | | `/clear` | Clear conversation and start fresh | When switching topics | +| `/help` | Show all available commands | When you forget a command | +| `/model` | Show or switch AI model | When you want to change the AI model | | `/plan` | Plan your work out before coding | For more complex features | | `/research` | Deep research using GitHub and web sources | When you need to investigate a topic before coding | -| `/model` | Show or switch AI model | When you want to change the AI model | | `/exit` | End the session | When you're done | +> ๐Ÿ’ก **`/ask` vs regular chat**: Normally every message you send becomes part of the ongoing conversation and affects future responses. `/ask` is an "off the record" shortcut โ€” perfect for quick one-off questions like `/ask What does YAML mean?` without polluting your session context. + +> ๐Ÿ’ก **Tab-completion**: When typing a slash command, press **Tab** to auto-complete the command name or cycle through available subcommands and arguments. This is especially handy when you can't remember the exact name of a command. + That's it for getting started! As you become comfortable, you can explore additional commands. > ๐Ÿ“š **Official Documentation**: [CLI command reference](https://docs.github.com/copilot/reference/cli-command-reference) for the complete list of commands and flags. @@ -424,19 +429,23 @@ That's it for getting started! As you become comfortable, you can explore additi | `/list-dirs` | Show all allowed directories | | `/cwd`, `/cd [directory]` | View or change working directory | -> โš ๏ธ **Use with caution**: `/allow-all` skips confirmation prompts. Great for trusted projects, but be careful with untrusted code. +> โš ๏ธ **Use with caution**: `/allow-all` and `/yolo` skip confirmation prompts. Great for trusted projects, but be careful with untrusted code. ### Session | Command | What It Does | |---------|--------------| -| `/resume` | Switch to a different session (optionally specify session ID) | -| `/rename` | Rename the current session | -| `/context` | Show context window token usage and visualization | -| `/usage` | Display session usage metrics and statistics | -| `/session` | Show session info and workspace summary | +| `/clear` | Abandons the current session (no history saved) and starts a fresh conversation | | `/compact` | Summarize conversation to reduce context usage | -| `/share` | Export session as markdown file or GitHub gist | +| `/context` | Show context window token usage and visualization | +| `/keep-alive` | Prevent your system from sleeping while Copilot CLI is active โ€” handy for long-running tasks on a laptop | +| `/new` | Ends the current session (saving it to history for search/resume) and starts a fresh conversation. | +| `/resume` | Switch to a different session (optionally specify session ID or name) | +| `/rename` | Rename the current session (omit the name to auto-generate one) | +| `/rewind` | Open a timeline picker to roll back to any earlier point in the conversation | +| `/usage` | Display session usage metrics and statistics | +| `/session` | Show session info and workspace summary; use `/session delete`, `/session delete `, or `/session delete-all` to remove sessions | +| `/share` | Export session as a markdown file, GitHub gist, or self-contained HTML file | ### Help and Feedback @@ -609,6 +618,7 @@ The examples used `/plan` for a search feature and `-p` for batch reviews. Now t | Typing `exit` instead of `/exit` | Copilot CLI treats "exit" as a prompt, not a command | Slash commands always start with `/` | | Using `-p` for multi-turn conversations | Each `-p` call is isolated with no memory of previous calls | Use interactive mode (`copilot`) for conversations that build on context | | Forgetting quotes around prompts with `$` or `!` | Shell interprets special characters before Copilot CLI sees them | Wrap prompts in quotes: `copilot -p "What does $HOME mean?"` | +| Pressing Esc once to cancel a running task | A single Esc no longer cancels in-flight work (to prevent accidents) | Press **Esc twice** to cancel while Copilot CLI is processing | ### Troubleshooting diff --git a/website/src/content/docs/learning-hub/cli-for-beginners/02-context-and-conversations.md b/website/src/content/docs/learning-hub/cli-for-beginners/02-context-and-conversations.md index 6c4fb0e5..2c4d052a 100644 --- a/website/src/content/docs/learning-hub/cli-for-beginners/02-context-and-conversations.md +++ b/website/src/content/docs/learning-hub/cli-for-beginners/02-context-and-conversations.md @@ -3,7 +3,7 @@ title: '02 ยท Context and Conversations' description: 'Learn how to give Copilot CLI richer context and build stronger multi-turn conversations.' authors: - GitHub Copilot Learning Hub Team -lastUpdated: 2026-03-20 +lastUpdated: 2026-05-01 --- ![Chapter 02: Context and Conversations](/images/learning-hub/copilot-cli-for-beginners/02/chapter-header.png) @@ -312,12 +312,15 @@ copilot --continue copilot --resume # Or resume a specific session by ID -copilot --resume abc123 +copilot --resume=abc123 + +# Or resume by the name you gave the session +copilot --resume="my book app review" ``` > ๐Ÿ’ก **How do I find a session ID?** You don't need to memorize them. Running `copilot --resume` without an ID shows an interactive list of your previous sessions, their names, IDs, and when they were last active. Just pick the one you want. > -> **What about multiple terminals?** Each terminal window is its own session with its own context. If you have Copilot CLI open in three terminals, that's three separate sessions. Running `--resume` from any terminal lets you browse all of them. The `--continue` flag grabs whichever session was closed most recently, no matter which terminal it was in. +> **What about multiple terminals?** Each terminal window is its own session with its own context. If you have Copilot CLI open in three terminals, that's three separate sessions. Running `--resume` from any terminal lets you browse all of them. The `--continue` flag grabs the session from the current working directory first; if none exists there, it picks the most recently active session. > > **Can I switch sessions without restarting?** Yes. Use the `/resume` slash command from inside an active session: > ``` @@ -327,15 +330,35 @@ copilot --resume abc123 ### Organize Your Sessions -Give sessions meaningful names so you can find them later: +Give sessions meaningful names so you can find them later. You can name a session when you start it, or rename it at any time while inside the session: ```bash +# Name a session right when you start it +copilot --name book-app-review + +# Or rename the current session from inside copilot > /rename book-app-review # Session renamed for easier identification ``` +Once a session is named, you can resume it directly by name without browsing through a list: + +```bash +copilot --resume=book-app-review +``` + +To clean up sessions you no longer need, use `/session delete` from inside a session: + +```bash +copilot + +> /session delete # Deletes the current session +> /session delete abc123 # Deletes a specific session by ID +> /session delete-all # Deletes all sessions (use with care!) +``` + ### Check and Manage Context As you add files and conversation, Copilot CLI's [context window](https://github.com/github/copilot-cli-for-beginners/blob/main/GLOSSARY.md#context-window) fills up. Two commands help you stay in control: @@ -363,10 +386,9 @@ Context usage: 45,000 / 128,000 tokens (35%) Imagine this workflow across multiple days: ```bash -# Monday: Start book app review -copilot +# Monday: Start book app review with a name right from the beginning +copilot --name book-app-review -> /rename book-app-review > @samples/book-app-project/books.py > Review and number all code quality issues @@ -384,8 +406,8 @@ Quality Issues Found: ``` ```bash -# Wednesday: Resume exactly where you left off -copilot --continue +# Wednesday: Resume exactly where you left off, by name +copilot --resume=book-app-review > What issues remain unfixed from our book app review? @@ -410,7 +432,7 @@ No re-explaining. No re-reading files. Just continue working. --- -**๐ŸŽ‰ You now know the essentials!** The `@` syntax, session management (`--continue`/`--resume`/`/rename`), and context commands (`/context`/`/clear`) are enough to be highly productive. Everything below is optional. Return to it when you're ready. +**๐ŸŽ‰ You now know the essentials!** The `@` syntax, session management (`--name`/`--continue`/`--resume`/`/rename`), and context commands (`/context`/`/clear`) are enough to be highly productive. Everything below is optional. Return to it when you're ready. --- @@ -853,7 +875,7 @@ copilot --add-dir /path/to/directory 1. **`@` syntax** gives Copilot CLI context about files, directories, and images 2. **Multi-turn conversations** build on each other as context accumulates -3. **Sessions auto-save**: use `--continue` or `--resume` to pick up where you left off +3. **Sessions auto-save**: name them at startup with `--name`, resume by name with `--resume=`, or use `--continue` to pick up the most recent session 4. **Context windows** have limits: manage them with `/context`, `/clear`, and `/compact` 5. **Permission flags** (`--add-dir`, `--allow-all`) control multi-directory access. Use them wisely! 6. **Image references** (`@screenshot.png`) help debug UI issues visually