Skip to content

Instantly share code, notes, and snippets.

@ShockwaveNN
Last active January 24, 2022 14:59
Show Gist options
  • Save ShockwaveNN/a04d3419c3956aec556f759283a1556e to your computer and use it in GitHub Desktop.
Save ShockwaveNN/a04d3419c3956aec556f759283a1556e to your computer and use it in GitHub Desktop.
master_update
#!/usr/bin/env bash
# https://gist.github.com/ShockwaveNN/a04d3419c3956aec556f759283a1556e/edit
master_branch_exists=$(git ls-remote --heads origin master)
if [[ -z ${master_branch_exists} ]]; then
git checkout main
else
git checkout master
fi
git pull --prune
GEMFILE=Gemfile
GEMS=gems.rb
SHOULD_BUNDLE=false
if test -f "$GEMFILE"; then
SHOULD_BUNDLE=true
fi
if test -f "$GEMS"; then
SHOULD_BUNDLE=true
fi
if [ "$SHOULD_BUNDLE" = true ] ; then
echo 'Seems this is ruby project. Check gems for update'
bundle install
bundle outdated
fi
git branch -av
git stash list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment