Last active
May 13, 2021 17:59
-
-
Save alexfu/cfc7480cd317d57eebcbfed3fa3fa578 to your computer and use it in GitHub Desktop.
git eject
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 | |
# Bails on current working branch and switches to main | |
# Install: Place this script anywhere that is in your $PATH and make it executable (chmod +x) | |
BRANCH_TO_EJECT=$(git rev-parse --abbrev-ref HEAD) | |
git reset HEAD --hard | |
git checkout main | |
git br -D $BRANCH_TO_EJECT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment