I have (amongst others) git aliases:
grm
:git rebase master
grim
:git rebase -i master
The development community as a whole is moving away from the use for master
for the default branch, in favour of main
. (For reasons relating to historical associations)
Unfortunately the community isn't doing that uniformly, and I frequently switch between projects, so I'd have to keep editing my aliases.
Is there any way to write the alias so that it interacts with "whichever of master
or main
exists in this repo"? (Happy to have it assume that only one of the 2 exists, locally)
Re: Suggested answer. The problem is not "I as a human don't know which is in use in this repo"; That's trivial to identify by glancing at the history. It's that my *alias* doesn't know.
I'd assumed that the solution would be something that "tries both options" in some way, but a solution that uses the linked question to determine the correct answer directly and then uses that answer would also work.