Created
November 19, 2020 15:37
-
-
Save kraftwerk28/004d3ff0853645c224f9641992ec5ad1 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env sh | |
TOKEN="api-token" | |
master=${1:-"master"} | |
APIURL="https://api.github.com" | |
OWNER=$(git config --get user.name) | |
REPO=$(basename $(git rev-parse --show-toplevel)) | |
git checkout -b master | |
git push origin master | |
curl -s -X PATCH "$APIURL/repos/$OWNER/$REPO" \ | |
-d "{\"default_branch\":\"master\"}" \ | |
-H "Authorization: token $TOKEN" > /dev/null | |
git push origin -d main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment