You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Diff of a selected directory doesn't show its new files, but space stages them #6246
Written by Claude after discussing, reviewed it before posting. If you don't like this kind of report i can close it.
Describe the bug
When I select a directory in the Files panel, the main view shows the changes to the tracked files inside it, but not the new (untracked) files. If I then press space, the new files get staged too. So it's easy to stage files you never saw in the diff.
It looks like the same problem as #4245, which #4386 fixed for the "only tracked files" filter. Here there's no filter involved.
To Reproduce
In a repo, change a tracked file in a directory, for example d/old.txt.
Create a new file in the same directory: d/new.txt.
Open lazygit and select d in the Files panel. The diff only shows the change to d/old.txt.
Press space. Both files are staged, including d/new.txt.
Expected behavior
The diff for a directory shows everything that pressing space will stage. New files would appear as new-file diffs, the same way they do when you select a single untracked file.
(Making space skip the untracked files would also remove the surprise, but then there'd be no easy way to stage a whole directory with its new files.)
Ghostty 1.3.1. I don't think it's terminal-related.
Additional context
I haven't built master, but reading the code there: for a directory, WorktreeFileDiffCmdObj runs git diff -- <dir>, and the --no-index /dev/null form is only used when the selected node is a single untracked file. So untracked files under a directory never make it into the diff. That code is the same as in 0.65.0.
I sometimes find this confusing myself; for example when you only have one directory with a single untracked file: select the file and you see its diff, press up once to select the directory, and the diff is empty. That is a bit weird.
On the other hand, we can't make the change you are suggesting. It is the expected behavior only for the case that you just created a new file and want to stage it. But sometimes I have untracked files sitting there in my working copy and I have no intention to commit them; e.g. notes that I'm taking during development, or an agent plan, or sometimes tool artefacts that I don't bother git-ignoring. I totally don't want any of these to show up in the diff when I select the / directory to see all my changes.
This is a dilemma for which I can't think of a good solution; but I feel the current behavior is the best we can do. I also don't see it as so much of a usability problem as you make it sound: after you press space, you do see the added files in the diff, so you can still double-check that what you are committing looks right.
Very reasonable, yes, i agree. I don't suppose we could make it some kind of toggle or user option? Such as: i'm reviewing a whole dir and i press a certain key and now the diff includes all files inside it. I usually review a semi-specific dir, and my dev artifacts are normally elsewhere.
It's not a huge deal, again, but i did find it misleading because my LLM authored some changes and i had missed the new files when reviewing.
Activity
stefanhaller commentedon Nov 25, 2026
I sometimes find this confusing myself; for example when you only have one directory with a single untracked file: select the file and you see its diff, press up once to select the directory, and the diff is empty. That is a bit weird.
On the other hand, we can't make the change you are suggesting. It is the expected behavior only for the case that you just created a new file and want to stage it. But sometimes I have untracked files sitting there in my working copy and I have no intention to commit them; e.g. notes that I'm taking during development, or an agent plan, or sometimes tool artefacts that I don't bother git-ignoring. I totally don't want any of these to show up in the diff when I select the
/directory to see all my changes.This is a dilemma for which I can't think of a good solution; but I feel the current behavior is the best we can do. I also don't see it as so much of a usability problem as you make it sound: after you press space, you do see the added files in the diff, so you can still double-check that what you are committing looks right.
MartinCura commentedon Nov 26, 2026
Very reasonable, yes, i agree. I don't suppose we could make it some kind of toggle or user option? Such as: i'm reviewing a whole dir and i press a certain key and now the diff includes all files inside it. I usually review a semi-specific dir, and my dev artifacts are normally elsewhere.
It's not a huge deal, again, but i did find it misleading because my LLM authored some changes and i had missed the new files when reviewing.
Thanks!