![]() I don't think it is a good idea to have the user look at one diff and then apply another related but different diff instead, which is what your prefix argument suggestion amounts too. A "toggle -ignore-space-changes" command would help here. It might also be inconvenient to have to enter the popup twice.It don't want to fake the latter in Magit. Git only offers -ignore-space-changes but not -only-space-changes.It might be a bit inconvenient that this requires two steps, but.It might be necessary to also force -unidiff-zero to be used.That isn't accurate and also not relevant here. apply is already always called with -ignore-space-change.That only works if you work on the sub-file level.Enable -ignore-space-changes and put it into effect using g.In the status buffer press D to enter the "change diff arguments used in this buffer" popup. ![]() ![]() That already exists but is more centered around diff than apply. I hope that better illustrates the feature that I think would be really cool.Īs I mentioned, a generalized whitespace "mask" for apply operations could be more broadly useful/powerful. Ex: C-u S to stage all non-whitespace changes, C-u C-u s to stage all whitespace changes according to the current point (ex: within a file, hunk, or region), or C-u C-u U to unstage all whitespace changes. It's not necessarily a good idea for implementation of this hypothetical feature, but I can imagine for example using a prefix command with the existing apply commands. I currently use git diff -U0 -w -no-color | git apply -cached -ignore-whitespace -unidiff-zero - ( original source) to isolate non-whitespace changes when staging. Changes to be committed: (use 'git restore -staged . How to Delete a Commit from Source Tree By leo.acosta SeptemAs this was a bit of a head-scratcher for me I decided I would document exactly the steps on how to delete a commit which has been pushed to a remote repo.The whitespace mistakes could be isolated and corrected in a commit without needing to stash or discard changes to code. First, run git status to make sure you have staged the file (meaning you used git add) : On branch main Your branch is up to date with 'origin/main'. If the unmodified file has trailing whitespace on a line and I deleted it while reading through the code and making changes I want to be able to unstage/discard that and any other whitespace changes I made en-masse so that my commit does not include extraneous line modifications.Īs I mentioned, a generalized whitespace "mask" for apply operations could be more broadly useful/powerful. What whitespace-cleanup regards as correct may frequently be different from the form of whitespace of the unmodified file. I want to preserve whitespace mistakes if they already exist. My intent, however is to regard the git version as authoritative/correct.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |