You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gs_format_code() {
files="$(git diff --name-only --diff-filter=d $1$2)"echo"Manually formatting just these files:"echo"$files"
clang-format --verbose -i --style=file $files
}
The text was updated successfully, but these errors were encountered:
ElectricRCAircraftGuy
changed the title
Add format options for path and changed files
Add format options for path and changed files based on git diffMar 16, 2021
Options should include a list of files or dirs, or a commit range of changed files.
See also my answer here: https://stackoverflow.com/questions/30905086/git-list-of-all-changed-but-not-deleted-files-in-a-commit/66649684#66649684.
The below func works only on filenames which have no spaces or special bash chars. So, make it work with spaces too!
To make it handle these chars, it will require using
git diff --name-only -z
or something. See my answer here: https://stackoverflow.com/questions/28109520/how-to-cope-with-spaces-in-file-names-when-iterating-results-from-git-diff-nam/62853776#62853776Example:
The text was updated successfully, but these errors were encountered: