Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Ability to filter list of files by file name/path #3

Open
smuuf opened this issue Oct 24, 2024 · 2 comments
Open

Feature request: Ability to filter list of files by file name/path #3

smuuf opened this issue Oct 24, 2024 · 2 comments

Comments

@smuuf
Copy link

smuuf commented Oct 24, 2024

Hi, I've always thought it would be handy to have the possibility to filter list of files by its name/path. Something like:

obrazek
(yeah, I have some colors in git-gui.sh tweaked as a home-made attempt at dark mode GUI...)

  • This could filter both in "Unstaged changes" and also in "Staged changes" lists at the same time.
  • It could also support naive and simple wildcarding (a single * meaning "one or more of any characters", i.e. regex .+).
    • E.g. my_dir_a*my_dir_b would keep both of these:
      • my_dir_in_repo/my_dir_a/whatever/my_dir_b/yay.php
      • my_dir_in_repo/my_dir_a_merged_with_my_dir_b
  • It could also support case-insensitive filtering.

As a bonus, something similar would be handy in a form of "filter files by text search in diff". E.g. I could easily find all files where I renamed my_function_a to my_function_b and make a commit only from those files, even if I have hundreds of other changed files.

@j6t
Copy link
Owner

j6t commented Oct 24, 2024

If such a filter exists and not all files are listed, then an outstanding indication must be visible that indicates the fact. Otherwise, it would be all too easy to stage just part of the changed files.

Thinking a bit more on it:

  • IMO, the list of staged files must not be filtered: It must be clear at all times what is about to be committed.
  • Is it really the case that a filter is needed? Wouldn't it be sufficient to just search the list and have it scroll to a particular file? Or highlight the files matching a pattern without removing the others?

@smuuf
Copy link
Author

smuuf commented Oct 25, 2024

Or highlight the files matching a pattern without removing the others?

This might also do it :)

My use case is that I'm having hundreds of files changed (like a massive refactoring), but for "good development process reasons" I'd like to separate all of these changes into logically standalone commits. I also know how to identify the files I'd like to have in the soon-to-be-commit (either by specific filename/part-of-path or by specific text in line diff), but I'm currently not able to distinguish them in the list of unstaged files.

The use case for having the "filter" (or highlights, as you suggest) applied in the list of staged files is the ability to undo the staging of some "accidentally" staged files during the process (e.g. the staged file XYZ doesn't match what the commit will be about, so it shouldn't be there and I want to unstage it).

All-in-all, both of your points are good points - and if there's no filtering but merely highlighting, IMHO, it also solves both of the points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants