Skip to content

Instantly share code, notes, and snippets.

@nrutman
Last active February 19, 2019 20:57
Show Gist options
  • Save nrutman/37757113dd0f8f60072f00e0c0310694 to your computer and use it in GitHub Desktop.
Save nrutman/37757113dd0f8f60072f00e0c0310694 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Merges the latest release into the current Git branch (based on semver
# tagging).
# Get up to date with origin
git fetch origin &> /dev/null
# Find the latest release tag
release=$(git tag --sort=v:refname | grep "^\\d\{1,2\}\.\\d\{1,2\}\.\\d\{1,4\}\$" | tail -1)
# Error if no versions were found
if [ -z "$release" ]
then
echo -e "\033[91mNo versions exist in this repository!"
exit 1
fi
# Merge in the latest release
git merge ${release}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment