AI / GitHub Copilot CLI Fundamentals Interview Questions
What does GitHub Copilot CLI's diff and undo capability provide?
After Copilot makes file modifications, Copilot CLI provides review and undo capabilities so you can inspect changes before committing them or roll back actions that produced unexpected results.
# After Copilot edits files, review the diff # Copilot CLI shows a diff view of changes made in the session # Review changes with standard git tooling git diff # see all changes Copilot made git diff src/api/users.ts # changes to a specific file # Undo all changes Copilot made in the session git checkout . # restore all tracked files git clean -fd # remove any new untracked files Copilot created # Selective undo - restore just one file git checkout src/api/users.ts # Copilot CLI also shows inline diffs during Plan mode # before executing - use Plan mode (Shift+Tab) to preview # changes before they are applied # Best practice: commit your work before a Copilot session git add -A && git commit -m "WIP: state before Copilot session" # → Easy rollback point if Copilot makes unwanted changes
Best practice before any Copilot CLI session: commit your current work or stash it (git stash). This gives you a clean rollback point - if Copilot's changes are not what you wanted, a single git checkout . undoes everything since the commit.
More Related questions...