- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-save
More file actions
Latest commit
executable file
·34 lines (27 loc) · 638 Bytes
/
Copy pathgit-save
File metadata and controls
executable file
·34 lines (27 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
source"utils.sh"
# Get my status
lines=$(git status -s)
added_a_file=0
IFS=$'\n'
forlinein$lines;do
# The first 2 characters tell us the status
s=${line:0:2}
file=${line:3}
if [[ "${s}"=="??" ]];then# new file
write "\nKeep <red>${file}</red>? "
else
write "\nKeep <green>${file}</green>? "
fi
read -r choice
if [[ "${choice}"=="y" ]];then
git add "${file}"
added_a_file=1
fi
done
if [[ $added_a_file== 1 ]];then
write "\nEnter a commit message:"
printf"\n\n"
read -r commit_msg
git commit -m "${commit_msg}"
fi