Last active
June 17, 2020 20:20
-
-
Save blimmer/a7bf33cad9262f01a37be3aba35d881b to your computer and use it in GitHub Desktop.
A helper tool to fix local clones after renaming "master" branches to "main"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -e | |
if ! git diff-index --quiet HEAD --; then | |
echo "ERROR: you have uncommited changes. Please stash or commit before running this script." | |
exit 1 | |
fi | |
git fetch | |
git checkout main | |
git pull origin main | |
delete_branch=$(git branch -D master) || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment