checkpoints.mdx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. title: "Checkpoints"
  3. sidebarTitle: "Checkpoints"
  4. ---
  5. Checkpoints automatically save snapshots of your workspace after each step in a task. This feature lets you track changes, roll back when needed, and experiment confidently with your code.
  6. ## How Checkpoints Work
  7. Cline creates a checkpoint after each tool use (file edits, commands, etc.). These checkpoints:
  8. - Work alongside your Git workflow without interference
  9. - Maintain context between restores
  10. - Use a shadow Git repository to track changes
  11. For example, if you're working on a feature and Cline makes multiple file changes, each change creates a checkpoint. This means you can review each modification and, if needed, roll back to any point without affecting your main Git repository.
  12. ## Enabling or Disabling Checkpoints
  13. Checkpoints are enabled by default in Cline. To toggle this feature:
  14. 1. Open the Cline settings by clicking the gear icon in the Cline panel
  15. 2. Go to "Feature Settings"
  16. 3. Toggle the **"Enable Checkpoints"** checkbox on or off
  17. <Frame>
  18. <img
  19. src="https://storage.googleapis.com/cline_public_images/checkpoints.gif"
  20. alt="Checkpoints toggle in settings"
  21. />
  22. </Frame>
  23. ### When to Disable Checkpoints
  24. While checkpoints provide valuable safety nets, you might want to disable them in certain situations:
  25. - **Large repositories**: If you're working with very large codebases, checkpoints may use additional storage space
  26. - **Performance concerns**: On systems with limited resources, disabling checkpoints can slightly improve performance
  27. - **Simple tasks**: For quick, low-risk operations where rollback isn't needed
  28. ## Viewing Changes & Restoring
  29. After each tool use, you can:
  30. 1. Click the "Compare" button to see modified files
  31. 2. Click the "Restore" button to open restore options
  32. <Frame>
  33. <img
  34. src="https://storage.googleapis.com/cline_public_images/docs/assets/image%20(13).png"
  35. alt="Checkpoint comparison and restore options"
  36. />
  37. </Frame>
  38. ## Restore Options
  39. To restore to a previous point:
  40. 1. Click the "Restore" button next to any step
  41. 2. Choose from three options:
  42. - **Restore Task and Workspace**: Reset both codebase and task to that point
  43. - **Restore Task Only**: Keep codebase changes but revert task context
  44. - **Restore Workspace Only**: Reset codebase while preserving task context
  45. Example: If Cline makes changes you don't like while styling a component, you can use "Restore Workspace Only" to revert the code changes while keeping the conversation context, allowing you to try a different approach.
  46. <Frame caption="Reverting both codebase and task to before any changes were made to start fresh">
  47. <img src="https://storage.googleapis.com/cline_public_images/docs/assets/checkpointsDemo.gif" alt="Checkpoint restore demo" />
  48. </Frame>
  49. ## Use Cases
  50. Checkpoints let you be more experimental with Cline. While human coding is often methodical and iterative, AI can make substantial changes quickly. Checkpoints help you track these changes and revert if needed.
  51. ### Using Auto-Approve Mode
  52. - Provides safety net for rapid iterations
  53. - Makes it easy to undo unexpected results
  54. ### Testing Different Approaches
  55. - Try multiple solutions confidently
  56. - Compare different implementations
  57. - Quickly revert to working states
  58. - Ideal for exploring different design patterns or architectural approaches
  59. ## Best Practices
  60. 1. Use checkpoints as safety nets when experimenting
  61. 2. Leverage auto-approve mode more confidently, knowing you can always roll back
  62. 3. Restore selectively based on needs:
  63. - Use "Restore Task and Workspace" for a fresh start
  64. - Use "Restore Task Only" to try different prompts, but keep file changes
  65. - Use "Restore Workspace Only" to attempt different implementations while preserving conversation context
  66. ## Relationship with Message Editing
  67. The [message editing feature](/features/editing-messages) uses checkpoints under the hood when you select the "Restore All" option. This allows you to not only edit and resubmit your message but also restore your workspace to the state it was in at that point in the conversation.
  68. ## Deleting Checkpoints
  69. You can delete all checkpoints by using the **"Delete All History"** button in the task history menu. Note that this will also delete all tasks. Checkpoints are stored in VS Code's globalStorage.