Skip to content

Instantly share code, notes, and snippets.

@Tyrael
Created November 14, 2011 14:09
Show Gist options
  • Save Tyrael/1364016 to your computer and use it in GitHub Desktop.
Save Tyrael/1364016 to your computer and use it in GitHub Desktop.
svn revert files in current directory having newline changes only
svn st|grep ^M|awk '{cmd = "svn diff -x --ignore-eol-style "$2;if ((cmd | getline result) <= 0) system("svn revert "$2);}'
@ampacs
Copy link

ampacs commented Jul 4, 2021

Needed to add support for (evil) filenames that have whitespaces, @, and any combination of () [] {}:

svn st | grep ^M | sed -e 's/^M\s\{2,\}//' -e '/@/ s/$/@/' -e '/[][)(}{\s]/ s/.*/"&"/' | awk '{cmd = "svn diff -x --ignore-eol-style "$0;if ((cmd | getline result) <= 0) system("svn revert "$0);}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment