updated git.sh

pull/2/head
Hari Sekhon 5 years ago
parent 4a11a7079f
commit 3dea9e72e2

@ -566,11 +566,15 @@ revert_typechange(){
} }
rm_untracked(){ rm_untracked(){
if [ $# -lt 1 ]; then
echo "usage: rm_untracked <target_dir_or_files_or_glob>"
return 1
fi
# iterate on explicit targets only # iterate on explicit targets only
# intentionally not including current directory to avoid accidentally wiping out untracked files - you must specify "rm_untracked ." if you really intend this # intentionally not including current directory to avoid accidentally wiping out untracked files - you must specify "rm_untracked ." if you really intend this
for x in "${@:-}"; do for x in "${@:-}"; do
# want splitting to separate filenames # want splitting to separate filenames
# shellcheck disable=SC2046 # shellcheck disable=SC2046
rm -v $(git status --porcelain -s "$x" | awk '/^??/{print $2}') rm -v $(git status --porcelain -s "$x" | awk '/^\?\?/{print $2}')
done done
} }

Loading…
Cancel
Save