list_changes
View unstaged Git changes with numbered lines to selectively stage specific modifications or new files for creating focused commits.
Instructions
View unstaged git changes with line-level selection numbers for partial staging.
PREFER THIS OVER git diff when you need to selectively stage changes. Unlike git diff,
this tool includes untracked files (newly created files) in the output. This tool numbers
each changed line (0001, 0002, etc.) so you can stage specific lines or ranges instead of
entire files. Essential for creating multiple logical commits from intermixed changes.
Key features:
Includes untracked files (status: "added") as well as modified files (status: "modified")
Numbers every changed line for precise selection
Supports byte-based pagination to protect LLM context
Auto-truncates large diffs (>10KB) with clear indication
Handling truncated files:
When a file shows truncated: true with empty lines: [], use the diff tool to view
its complete content. The diff tool returns the same numbered line format needed for
partial staging with apply_changes, whereas git diff output lacks line numbers and
cannot be used for selective staging. For example, if a large refactored file is truncated,
call diff(path="src/large_module.py") to see the full numbered diff and selectively stage
related changes.
Use cases:
Breaking up large changes into multiple focused commits
Staging only specific changes while keeping others unstaged
Creating atomic commits from work-in-progress code
Separating refactoring from feature changes
Selectively staging parts of newly created files
After viewing changes, use apply_changes with the line numbers to stage selected changes.
Args: paths: Optional list of file paths to filter (default: all files) page_token: Opaque pagination token from previous response page_size_files: Max files per page - safety limit (default: PAGE_SIZE_FILES_DEFAULT) page_size_bytes: Max bytes per page - primary limit (default: PAGE_SIZE_BYTES_DEFAULT) unified: Context lines around changes (default: UNIFIED_LIST_DEFAULT)
Returns: JSON string with format: {page_token_next, files: [{path, binary, lines}], stats}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | No | ||
| page_token | No | ||
| page_size_files | No | ||
| page_size_bytes | No | ||
| unified | No |