3

I have a number of text files and from time to time I start up a tool that removes the trailing white space. Is it possible to use git apply --whitespace=fix for that purpose (and get rid of the other tool I was using)?

I tried something like git apply --whitespace=fix testfile.txt but that did not work, I guess it only works on patch files, but I want to use it with any kind of text files.

I do not want to run the command on every check-out or commit (there are some answers doing that), I just want to run it manually from time to time and if I like the output, I will commit it, separately from changes to the content.

matth
  • 2,568
  • 2
  • 21
  • 41
  • http://stackoverflow.com/questions/591923/make-git-automatically-remove-trailing-whitespace-before-committing. – Jayan Jan 05 '15 at 14:11
  • @Jayan yes, I am aware of that question, but I do not want to automatically remove whitespace on every commit, I want to use it more like a standalone tool – matth Jan 05 '15 at 14:16

1 Answers1

-1

Maybe you can try the following command line to ignore whitespace.

git apply --ignore-whitespace patch.diff

Generally, I used this to apply a patch.

buddemat
  • 4,552
  • 14
  • 29
  • 49