Skip to content

Commit b65e7d9

Browse files
Fix: Include staged changes in the git selector
1 parent 563df69 commit b65e7d9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docs/guides/model_selection.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ Models:
242242
#### Select with git changes
243243

244244
The git-based selector allows you to select models whose files have changed compared to a target branch (default: main). This includes:
245+
245246
- Untracked files (new files not in git)
246-
- Uncommitted changes in working directory
247+
- Uncommitted changes in working directory (both staged and unstaged)
247248
- Committed changes different from the target branch
248249

249250
For example:

sqlmesh/utils/git.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ def list_untracked_files(self) -> t.List[Path]:
1616
)
1717

1818
def list_uncommitted_changed_files(self) -> t.List[Path]:
19-
return self._execute_list_output(["diff", "--name-only", "--diff-filter=d"], self._git_root)
19+
return self._execute_list_output(
20+
["diff", "--name-only", "--diff-filter=d", "HEAD"], self._git_root
21+
)
2022

2123
def list_committed_changed_files(self, target_branch: str = "main") -> t.List[Path]:
2224
return self._execute_list_output(

0 commit comments

Comments
 (0)