Skip to content

Commit 913c4c7

Browse files
authored
Merge pull request #42 from BHFock/untracked
Add --no-untracked option to git cl status
2 parents 244e207 + da5d40d commit 913c4c7

4 files changed

Lines changed: 28 additions & 8 deletions

File tree

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ url: "https://github.com/BHFock/git-cl"
99
repository-code: "https://github.com/BHFock/git-cl"
1010
license: BSD-3-Clause
1111
doi: "10.5281/zenodo.18722077"
12-
version: "1.1.6"
13-
date-released: "2026-04-17"
12+
version: "1.1.7"
13+
date-released: "2026-05-16"
1414
abstract: >-
1515
git-cl is a command-line tool that brings changelist support to Git.
1616
It introduces a pre-staging layer that allows developers to partition

docs/tutorial.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ Example output of `git cl st`, showing files grouped by changelist with standard
167167
alt="git cl st output showing changelists feature1, feature2, and No Changelist with colour-coded status codes"
168168
width="200"/>
169169

170+
#### Hiding untracked files
171+
172+
If your repository has many untracked files that clutter the output, you can hide them with `--no-untracked`:
173+
174+
```
175+
git cl st --no-untracked
176+
```
177+
178+
This is useful when working on a focused task and you only want to see files already known to Git.
179+
170180
### 2.3 Diff a changelist
171181

172182
```
@@ -609,7 +619,7 @@ Yes. Each worktree has its own independent set of changelists — changes made i
609619
| Task | Command | Alias |
610620
| ------------------------------- | --------------------------------------------------------- | ------------- |
611621
| Add files to a changelist | `git cl add <name> <files...>` | `git cl a` |
612-
| View grouped status | `git cl status [--all] [--no-color] ` | `git cl st` |
622+
| View grouped status | `git cl status [--all] [--no-untracked] [--no-color]` | `git cl st` |
613623
| Show diff for changelist(s) | `git cl diff <name1> [<name2> ...] [--staged]` | |
614624
| Stage a changelist | `git cl stage <name> [--delete]` | |
615625
| Unstage a changelist | `git cl unstage <name> [--delete]` | |

git-cl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Single file, zero dependencies beyond Python 3.9+ and Git.
5656
Cross-platform: Unix (fcntl) and Windows (msvcrt) file locking.
5757
"""
5858

59-
__version__ = "1.1.6"
59+
__version__ = "1.1.7"
6060

6161
import argparse
6262
import datetime
@@ -370,6 +370,8 @@ def clutil_get_git_status(include_untracked: bool = False) -> list[str]:
370370
cmd = ["git", "status", "--porcelain"]
371371
if include_untracked:
372372
cmd.append("--untracked-files=all")
373+
else:
374+
cmd.append("--untracked-files=no")
373375

374376
try:
375377
return subprocess.check_output(cmd, text=True).splitlines()
@@ -422,7 +424,9 @@ def clutil_sanitize_path(file_path: str, git_root: Path) -> Optional[str]:
422424
return None
423425

424426

425-
def clutil_get_file_status_map(show_all: bool = False) -> dict[str, str]:
427+
def clutil_get_file_status_map(
428+
show_all: bool = False,
429+
include_untracked: bool = True) -> dict[str, str]:
426430
"""
427431
Get a mapping of files to their Git 2-letter status codes.
428432
@@ -436,13 +440,15 @@ def clutil_get_file_status_map(show_all: bool = False) -> dict[str, str]:
436440
437441
Args:
438442
show_all (bool): If True, include all files regardless of status code.
443+
include_untracked (bool): If True (default), list every untracked file.
444+
If False, untracked files are excluded entirely from the status map.
439445
440446
Returns:
441447
dict[str, str]: Mapping of relative file paths
442448
to their Git status codes.
443449
"""
444450
git_root = clutil_get_git_root()
445-
output = clutil_get_git_status(include_untracked=True)
451+
output = clutil_get_git_status(include_untracked=include_untracked)
446452

447453
# Allowlist of known meaningful status codes
448454
INTERESTING_CODES = {
@@ -2525,7 +2531,9 @@ def cl_status(args: argparse.Namespace) -> None:
25252531
changelists = clutil_load()
25262532
stashes = clutil_load_stashes()
25272533
git_root = clutil_get_git_root()
2528-
status_map = clutil_get_file_status_map(show_all=args.all)
2534+
status_map = clutil_get_file_status_map(
2535+
show_all=args.all,
2536+
include_untracked=not args.no_untracked)
25292537

25302538
use_color = clutil_should_use_color(args)
25312539

@@ -3241,6 +3249,8 @@ def main() -> None:
32413249
status_parser.add_argument('--all', action='store_true',
32423250
help=("Include files with uncommon Git "
32433251
"status codes"))
3252+
status_parser.add_argument('--no-untracked', action='store_true',
3253+
help='Hide untracked files (??) from output')
32443254
status_parser.add_argument('--no-color', action='store_true',
32453255
help='Disable colored output')
32463256
status_parser.set_defaults(func=cl_status)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = git-changelists
3-
version = 1.1.6
3+
version = 1.1.7
44
author = Bjoern Hendrik Fock
55
description = Git subcommand for named changelist support. Group working directory files by intent, then stage, commit, or branch by changelist.
66
long_description = file: README.md

0 commit comments

Comments
 (0)