I have a git repo, where I replaced a lot of files locally.
git status now shows many many modified files.
Some are \"really modified\", others only differ by li
Though it seems you were originally looking for a pipe-based solution and you got it from @aristotle-pagaltzis, since it's a bit hard to remember, I think this alternative is worth noting:
git diff -b > gitdiffb
git stash # or git reset --hard if you feel confident
git apply --ignore-space-change gitdiffb
If not just changes to whitespace numbers, but also whitespaces that are completely new or completely removed should be ignored, replace -b
by -w
.
The outcome differs from the pipe-based solution in the removal of whitespace changes even in files that also contain relevant changes. Thus, it's not exactly the way you described it, but for most people coming here via a search engine are probably rather looking for this.