blob: e9a808af38cd061d385e5b96af36cc7027450143 (
plain)
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
|
#!/bin/bash
set -euo pipefail
die()
{
echo "$@" 1>&2
exit 1
}
current_branch()
{
git rev-parse --abbrev-ref HEAD
}
uncommitted () {
git status --short | grep '^ M ' > /dev/null
}
case "$(current_branch)" in
master|main)
if uncommitted
then
die "there are uncommitted change"
fi
git pull --rebase gitlab HEAD
git push origin HEAD
;;
*)
die "not in main or master branch"
;;
esac
|