Files
tudien/bin/clean_untracked.sh
2026-10-02 22:54:53 +08:00

14 lines
428 B
Bash
Executable File

#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Confirm the script is being run in a Git repository
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo "Error: This script must be run inside a Git repository."
exit 1
fi
# Automatically clean untracked files and directories
git clean -fdx
echo "All non-tracking files and directories have been removed."