Skip to content

Commit dfe1b2f

Browse files
committed
also check if local is behind remote
1 parent afd5e85 commit dfe1b2f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

distribution/build_and_upload_gcp_artifacts.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ if [[ -n $(git diff HEAD) ]]; then
66
exit 1
77
fi
88

9+
# Get current branch name
10+
local_branch=$(git rev-parse --abbrev-ref HEAD)
11+
12+
# Fetch latest from remote
13+
git fetch origin $local_branch
14+
15+
# Check if local is behind remote
16+
if [[ -n $(git diff HEAD..origin/$local_branch) ]]; then
17+
echo "Error: Your branch is not in sync with remote"
18+
echo "Please push your local changes and sync your local branch $local_branch with remote"
19+
exit 1
20+
fi
21+
922
set -e
1023

1124
SCRIPT_DIRECTORY=$(dirname -- "$(realpath -- "$0")")

0 commit comments

Comments
 (0)