In my .bashrc
, I have aliases:
#Custom aliases
alias gta="git add -A"
alias gtc="git commit -m 'Added files' "
I want to create a new alias that does the command git push origin <branch name>
.
Earlier it was easy because it was always set to git push origin master
.
But now , GitHub has changed master
to main
for all repositories created after October 2020.
Now what I want is that I want to set an alias gtp
and it asks me a prompt to use main
or master
.
Depending on the selection, I want the appropriate commands to be executed.
P.S: I know that we can make 2 aliases , one for master
and one for main
, but just out of curiosity, how to solve the above problem?
alias gtp="git push"