Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git alias on current branch

Tags:

git

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.

like image 579
plus- Avatar asked Feb 27 '13 12:02

plus-


People also ask

Where do I put git alias?

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' .

How do I make an alias command in git?

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.


1 Answers

[alias]   po = "!git push --set-upstream origin \"$(git rev-parse --abbrev-ref HEAD)\"" 
like image 182
jmgarnier Avatar answered Oct 05 '22 14:10

jmgarnier