diff --git a/.bash.d/git.sh b/.bash.d/git.sh index 9a3ce9e5..4ad52894 100644 --- a/.bash.d/git.sh +++ b/.bash.d/git.sh @@ -566,11 +566,15 @@ revert_typechange(){ } rm_untracked(){ + if [ $# -lt 1 ]; then + echo "usage: rm_untracked " + return 1 + fi # 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 for x in "${@:-}"; do # want splitting to separate filenames # shellcheck disable=SC2046 - rm -v $(git status --porcelain -s "$x" | awk '/^??/{print $2}') + rm -v $(git status --porcelain -s "$x" | awk '/^\?\?/{print $2}') done }