Created
November 29, 2018 10:38
-
-
Save MartyLake/b76796d70bd65f4e601093477571a566 to your computer and use it in GitHub Desktop.
Bash alias to format files that changed before commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#format only files that have a diff | |
alias gformat="git diff --name-only --ignore-submodules | xargs -I {} sh -c 'export f="{}"; cd \$(git rev-parse --show-toplevel) && [[ -f \$f ]] && echo formatting \$f && clang-format -i --style=file \$f || echo directory \$f'" | |
#fix osx gitgui bug + format all files + open git gui and gitk (I use these a lot to commit) | |
alias gh="git config --local --unset gui.geometry && git push& gformat && git gui & gitk &" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment