Skip to content

Instantly share code, notes, and snippets.

@alexfu
Last active May 13, 2021
Embed
What would you like to do?
git eject
#!/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