Skip to content

Instantly share code, notes, and snippets.

@mbenford
Created October 20, 2014 19:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbenford/792acb7697c6f02b8904 to your computer and use it in GitHub Desktop.
Save mbenford/792acb7697c6f02b8904 to your computer and use it in GitHub Desktop.
Bash script to checkout either the latest release branch or the one specified
#!/bin/bash
set -e
if [ "$1" != "" ]; then
release_name="release/$1"
else
release_name=$(git branch -r | tail -n1 | sed 's/.*origin\///')
fi
echo "Checking out branch '$release_name'..."
git checkout $release_name
@NBLB24
Copy link

NBLB24 commented Jan 11, 2022

can you explain the method

@keriati
Copy link

keriati commented Jun 15, 2022

perfect thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment