P
P
pakrauce2015-12-08 18:45:22
ubuntu
pakrauce, 2015-12-08 18:45:22

Is it possible to make an alias for git push origin?

Is it possible to make an alias for git push origin my_branch so that it works with different branches? Tired of each time you need to enter the name of the branch to write the full command.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Lebedev, 2015-12-08
@zymanch

try these aliases:

# cat ~/.gitconfig
branch-name = "!git rev-parse --abbrev-ref HEAD"
publish = "!git push -u origin $(git branch-name)"

or set the push.default option in the configs:
now push will always happen from the current branch to the corresponding branch on the remote

S
sim3x, 2015-12-08
@sim3x

#.bash_aliases

alias WTF= "git push origin"

S
SidhArt, 2015-12-08
@SidhArt

I recommend zsh with git plugin, and in general I recommend zsh
https://github.com/robbyrussell/oh-my-zsh/wiki/Plu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question