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

add a way to remove from ignore file without opening .gitignore file in editor #1402

Closed
yilmazdurmaz opened this issue Oct 20, 2022 · 10 comments
Labels
feature-request question Further information is requested

Comments

@yilmazdurmaz
Copy link

Is your feature request related to a problem? Please describe.
I am new to gitui and wanted to give it a try. it is pretty nice but "ignoring" a file by accident has become a pain and seems to be so until you add this feature.

while trying it in a fresh folder with a single file in it, accidentally pressed i and new .gitignore file is created with that file's name in it. none of the actions has anything to revert this incident and editing needs an editor (namely nano for default settings which is not installed).

Describe the solution you'd like
I can think of 2 possible solutions:

  • add an "undo last operation" feature. this sound more plausible than the next one
  • add a line editor, or something like that, to remove a line instead of using a full editor.

Describe alternatives you've considered
an alternative would be trying to play with settings which would take more learning/remembering

Additional context
...

@extrawurst
Copy link
Collaborator

maybe I am missing something with your use case, every time I add something to the gitignore by accident this appears as a diff in the status that I can easily revert before committing?

@extrawurst extrawurst added the question Further information is requested label Oct 20, 2022
@yilmazdurmaz
Copy link
Author

maybe I am missing something with your use case, every time I add something to the gitignore by accident this appears as a diff in the status that I can easily revert before committing?

may I ask how you do that revert?

there is a "Reset" with shift+D shortcut (modifiers are shown in weird symbols by the way) and it also seems to be prone to accidents. it reverted gitignore file but then I have just removed that test file too (gone forever). is this what you are referring to?

@extrawurst
Copy link
Collaborator

you can reset/revert individual hunks in a diff, no need to reset whole folders or files "accidentally" and forever, just the ignore that you want to revert.

see the steps in this recording:
Screenflick Movie 7

@yilmazdurmaz
Copy link
Author

Hi @extrawurst , you closed the request but my intention for the request still holds open: "add a way to remove from ignore file"

Resetting hunk is valid only when you want to discard all changes from last commit. But it does not offer a solution for "accidental" addition to the ignore file.

Let me extend with another example situation: you do not have a wildcard option to ignore files, so you are selecting them by hand. there are many file you are trying to ignore and you want to remove few among other. the ones you want to remove might just slipped by, or you decided not to ignore, or even some old ones you want to un-ignore.

Resetting the changes/hunks is not suitable for this purpose, and opening an editor means leaving the gitui interface and is annoying.

meanwhile, I see a "reset lines [d]" and "stage lines [s]" commands that seemingly not doing anything while unstaged, and "unstages line [s]" for staged file that is close to what I describe, but moving between staged and unstaged is confusing.

as this is a feature request post, its implementation may even take 1-2 years. or you may mark it with some "not implementing" message. I hope you reconsider your decision to close.

PS: what are these "reset lines [d]" and "stage lines [s]" commands and why I could not make them work? bug maybe?

@extrawurst
Copy link
Collaborator

extrawurst commented Feb 21, 2023

meanwhile, I see a "reset lines [d]" and "stage lines [s]" commands that seemingly not doing anything while unstaged, and "unstages line [s]" for staged file that is close to what I describe, but moving between staged and unstaged is confusing.

you are right, the granular lines based ops do not support reverting lines that are unstaged. see #582 - this makes this issue a duplicate

@extrawurst
Copy link
Collaborator

conceptually gitui is not intended to be a substitute for your editor, that's why couples edits to the commit message send you to an editor. for any complex ignore file changes I apply the same. but yea #582 will solve your particular use case

@yilmazdurmaz
Copy link
Author

Alright, for the moment I will try this partial staging.

from your linked issue, I followed jumped to an older one. #59 (comment)

that comment of yours shows them working, and later you merged a commit, but "reset/stage lines" do not work for me on v0.22.1 for windows. shall I open a new bug report,

@extrawurst
Copy link
Collaborator

that comment of yours shows them working, and later you merged a commit, but "reset/stage lines" do not work for me on v0.22.1 for windows. shall I open a new bug report,

for sure, with a repro, that would be ideal

@yilmazdurmaz
Copy link
Author

I was thinkering about how to make a video to show you the reset/stage lines, and have found an interesting solution to the main problem of this discussion.

  • stage gitignore file (move under staged changes)
  • browse to the file under staged changes
  • switch to file, move to line and press "s" to unstage it
  • browse to the file under unstaged changes
  • switch to file, move to line and press "d" to remove it from file

PS: "d" key works this way but "s" is still doing nothing while file is under unstaged changes.

video-convert-1677001847037.webm

@yilmazdurmaz
Copy link
Author

yilmazdurmaz commented Feb 21, 2023

PS: "d" key works this way but "s" is still doing nothing while the file is under unstaged changes.

scratch that. this "stage lines [s]" works under the conditions that:

  • file is in the "staged changes" area
  • and at least 1 line is unstaged with "unstaged lines [s]"
  • then the file is viewed under the "unstaged changes" area
  • and finally, pressing "s" changes the line color indicating it is staged.

are the ones in my post above and this sequence here something you had in mind when you implemented these functions? (I will not post a new issue for the moment about this)

video-convert-1677002938368.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants