Skip to content

Instantly share code, notes, and snippets.

@cblecker
Created March 15, 2021 21:07
Show Gist options
  • Save cblecker/41ad288fcaaf6fbca8d2674b8b2534c8 to your computer and use it in GitHub Desktop.
Save cblecker/41ad288fcaaf6fbca8d2674b8b2534c8 to your computer and use it in GitHub Desktop.
git aliases for working with default branches
git config --global alias.default '!git symbolic-ref refs/remotes/origin/HEAD | sed '"'"'s:^refs/remotes/origin/::'"'"
git config --global alias.checkout-main '!git checkout $(git default)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment