Skip to content

Commit b13be12

Browse files
committed
Added continue question, if many changes available
1 parent 664fc01 commit b13be12

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

git/commit_helper.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ COLOR_BLUE="\e[36m"
77
COLOR_WHITE="\033[0;37m"
88
#COLOR_YELLOW="\033[0;33m"
99
#COLOR_OCHRE="\033[38;5;95m"
10+
CHANGED_FILES_WARN=25
1011

1112
show_help() {
1213
#echo -e '\n'
@@ -15,6 +16,7 @@ show_help() {
1516
echo -e '\t' "| (i)gnore - skip file |"
1617
echo -e '\t' "| (r)eset - unstage file |"
1718
echo -e '\t' "| checkout - checkout file (discard changes) |"
19+
echo -e '\t' "| rm - remove file |"
1820
echo -e '\t' "+----------------------------------------------------+"
1921
}
2022

@@ -32,6 +34,27 @@ read_command() {
3234
done
3335
}
3436

37+
CHANGED_FILES=$(git status -su | wc -l)
38+
if [[ "$CHANGED_FILES" -ge "$CHANGED_FILES_WARN" ]];
39+
then
40+
echo "Too many changed files ($CHANGED_FILES). Are you sure to continue? [y/n]";
41+
42+
while : ; do
43+
read_command
44+
45+
if [ "$cmd" == "y" ];
46+
then
47+
break
48+
fi
49+
50+
if [ "$cmd" == "n" ];
51+
then
52+
exit 100
53+
fi
54+
done
55+
fi
56+
57+
3558
git status -su | tr \\r \\n | while read -r line ;
3659
do
3760
FILE=$(echo "$line" | awk '{$1 = ""; print substr($0,2)}')

0 commit comments

Comments
 (0)