Hacker News new | ask | show | jobs
by JelteF 852 days ago
You can put this in your .gitconfig and do 'git checkout-default' to always checkout the default branch of the repo you're in, no matter what it's called:

    [alias]
    checkout-default = "!git checkout $(git rev-parse --abbrev-ref origin/HEAD | sed 's@^origin/@@')"
1 comments

This assumes there's a remote set up called "origin" - also an arbitrary name ;)
Luckily that's something that you control client side so you can simply be consistent about that yourself.