-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-pace
executable file
·72 lines (55 loc) · 1.27 KB
/
git-pace
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env sh
# Setup.
VERSION="0.1"
version() {
printf "git-pace version %s\n" "$VERSION"
git --version
}
# Helpers.
current_branch() {
basename "$(git symbolic-ref HEAD)"
}
current_epoch() {
date +%s
}
user_email() {
git config user.email
}
pace() {
# cd to git root directory
cd "$(git rev-parse --show-toplevel)"
git add -A
if [ -z "$1" ]; then
message=" -- via Git Pace"
else
message="$*"
fi
git commit -m "$message" --no-verify
for remote in $(git remote); do
git push --no-verify --set-upstream "${remote}" || true
done
if [ "$(git stash list)" != '' ]; then
for sha in $(git rev-list -g stash); do
git push --no-verify origin "$sha":refs/heads/"$(current_branch)"-stash-"$sha"
done
fi
printf "\n\nGit Pace done.\n"
}
display_help() {
cat <<-EOF
usage:
git pace [options] [COMMAND] [args]
commands:
git pace Add, commit, and push to remote with PACE :)
git pace <message> Execute git pace with <message> for commit message
options:
-V, --version Output current version of git-pace
-h, --help Display this help information
EOF
exit 0
}
case $1 in
-V|--version) version; exit 0 ;;
-h|--help) display_help; exit 0 ;;
esac
pace "$@"