-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush.sh
executable file
·51 lines (37 loc) · 926 Bytes
/
push.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
supports_wait() {
"$1" --help 2>&1 | grep -q -- '--wait'
}
if git diff-index --quiet HEAD --; then
echo "No changes to commit."
exit 0
fi
git add .
temp_file=$(mktemp /tmp/commit_message.XXXXXX)
echo "Previous commit messages:"
echo "------------------------"
git log -n 10 --date=format:"%Y-%m-%d %H:%M" --pretty=format:"%cd - %s"
if supports_wait "$EDITOR"; then
"$EDITOR" --wait "$temp_file"
else
${EDITOR:-nano} "$temp_file"
fi
commit_message=$(cat "$temp_file")
rm "$temp_file"
echo
echo "Commit message preview:"
echo "------------------------"
echo "$commit_message"
echo
echo "Is this message okay? (y/n)"
read -r confirmation
if [ "$confirmation" != "y" ]; then
echo "Commit aborted."
exit 0
fi
echo
git commit -m "$commit_message"
git push origin
echo "Changes have been committed successfully."
git tag v0.11.0 $( git rev-parse HEAD ) --force
git push origin --tags --force