I'd like to improve my current aliases, most of them work over a branch. Is there a way to refer to the current branch in a git alias so I don't need to pass it each time?
like this one:
git config alias.po "push origin"
is use it like that:
git po foo_branch
I'd like to just run git po
and it to take the current branch as a parameter.
Your git aliases are often stored per your user's configuration at ~/. gitconfig . You can also manually set aliases using, for example, the command git config alias. s 'status -s' .
It is important to note that there is no direct git alias command. Aliases are created through the use of the git config command and the Git configuration files. As with other configuration values, aliases can be created in a local or global scope.
[alias] po = "!git push --set-upstream origin \"$(git rev-parse --abbrev-ref HEAD)\""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With