jesseduffield / lazygit

simple terminal UI for git commands
MIT License
48.05k stars 1.73k forks source link

Discard ignored files #3607

Open veremenko-y opened 1 month ago

veremenko-y commented 1 month ago

Is your feature request related to a problem? Please describe. I need to ensure clean build, sometimes ignored files are the problem and need to be purged.

Describe the solution you'd like Two alternative solutions:

Describe alternatives you've considered Doing a custom command, but there's a chance that I'll forget about it, and I don't believe I can add it to the delete menu itself.

I could probably do the work myself, but I need guidance from maintainers to what option they would deem acceptable.

stefanhaller commented 1 month ago

If the goal is to do a clean build, then my first intuition is that this belongs in your build system infrastructure, not your git tool. Something like make clean && make.

My next suggestion would actually be to create a custom command for it; seems like a perfect candidate to me. The only downside would be that it doesn't appear in the shift-D menu, as you say.

Modifying "Nuke working tree" in this way is not an option, I'd say. It would be pretty infuriating to existing users of "Nuke working tree" if they loose their build artefacts and have to do a clean build afterwards. For C++ developers this can easily mean half an hour of rebuild time or more, depending on the size of your project.

Lastly, I guess I wouldn't be opposed to adding a new "Discard ignored files" entry to the shift-D menu, doing git clean -fdX. The keybinding should probably be i. The slight downside would be that it "pollutes" the already quite crowded menu with a not very frequently needed command (in my opinion), but it does fit well with the others that are already there.

veremenko-y commented 1 month ago

I'd like to indicate that my problem is I'm working on a repo that is not mine, and make clean does leave few things behind. I just want to confirm that artifacts left behind do not affect the build and the bug I experience. Lazygit is a new tool to me, but Git Extensions that I often used in cases like that doesn't work on linux well anymore. There I'd just toggle "show ignored files" to see what they are and either delete them all or some of them, but lazygit doesn't seem to support it in "Files" screen. As far as I can see once file is ignored it doesn't exist to Lazygit.

Next, I'd like to point out that to me, a new user, seeing the word Nuke with a cool animation (I do like it btw) gives me impression that my working directory is indeed nuked, ignored files included. But that's me + new tool problems I guess.

Lastly I want to note that I feel that I got an unnecessarily snarky reply (I could be wrong though, that's why I'm mentioning it explicitly), given the #1220, and it feels a little discouraging to provide more feedback. I want to emphasize that nobody owns me anything, and if you'd just say "Nah, I don't like it/I don't see many users needing it", I'd just reply "Cool, I'll add the custom command. I use this so rarely, I just want it to be in GUI to remind me of it's existence". And I would not have to write this reply, which I pretty much didn't enjoy doing.

stefanhaller commented 1 month ago

I feel that I got an unnecessarily snarky reply

Wow, sorry that it came across this way. Totally wasn't my intention, but I'm also surprised as to where in my reply you are reading that tone. I thought I was being pretty neutral and factual, at least that was my intention.

Anyway, I did say that I wouldn't be opposed to adding that menu entry, so if you want to contribute a PR to add this, you're welcome.

Also, thanks for providing the additional context, even if you didn't enjoy it. 😄

veremenko-y commented 1 month ago

Then whoops, totally my bad... I'm glad we figured it out though. I read it as "that's not a git issue, fix your build infrastructure" after recently waking up. Shouldn't have done that probably.

Also providing context wasn't a part I didn't enjoy, it's giving snarky reply part.

Anyway, I did say that I wouldn't be opposed to adding that menu entry, so if you want to contribute a PR to add this, you're welcome.

Sounds good, I'll take a look at the code later this week.