Skip to content

Instantly share code, notes, and snippets.

@GMNGeoffrey
Created January 21, 2022 01:49
Show Gist options
  • Save GMNGeoffrey/d2fe784745947fb54de2bf32acc362bc to your computer and use it in GitHub Desktop.
Save GMNGeoffrey/d2fe784745947fb54de2bf32acc362bc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Copyright 2022 Google LLC.
# SPDX-License-Identifier: Apache-2.0
set -e
set -o pipefail
if [[ -n "$(git status --porcelain --ignore-submodules)" ]]; then
echo "Working directory not clean"
git status
exit 1
fi
git checkout "${1?}"
git pull upstream "${1?}" --ff-only
git submodule update --init
if [[ -n "$(git status --porcelain --ignore-submodules=dirty)" ]]; then
echo "Working directory not clean after update"
git status
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment