Skip to content

Instantly share code, notes, and snippets.

@AtnNn
Created January 3, 2018 12:05
Show Gist options
  • Save AtnNn/10d17408516ae408788484418740f18b to your computer and use it in GitHub Desktop.
Save AtnNn/10d17408516ae408788484418740f18b to your computer and use it in GitHub Desktop.
git diff -U1 |
  perl -ne '
    if (m|^\+\+\+ b/(.*)|) { $name = $1 }
    if (m|^@@.*\+(\d+),(\d+)|) { $from = $1; $to = $from + $2; print "clang-format -lines=$from:$to -style=file -i $name\n" }
  ' |
  sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment