hypnagaga/scripts/update-graphics-components.sh

17 lines
548 B
Bash

#!/bin/bash
# Usage: ./update-graphics-components.sh [branch]
# Default branch is 'main' if not specified.
# Add upstream remote and fetch
set -e
REPO_URL="https://github.com/reuters-graphics/graphics-components.git"
REMOTE_NAME="upstreamRepo"
SUBTREE_PREFIX="graphics-components-src"
BRANCH="${1:-main}"
git remote | grep -q "^$REMOTE_NAME$" || git remote add $REMOTE_NAME $REPO_URL
git fetch $REMOTE_NAME
git subtree pull --prefix=$SUBTREE_PREFIX $REMOTE_NAME $BRANCH --squash
echo "graphics-components-src updated from $REPO_URL ($BRANCH)"