DEV Community

Discussion on: Why Git Alias

Collapse
 
vlasales profile image
Vlastimil Pospichal • Edited

My aliases in ~/.gitconfig

ci = commit -v
co = checkout
unstage = reset HEAD --
last = log -3
list = log -10 --oneline --decorate
newbranch = checkout -b
exclude = !editor .git/info/exclude
ignore = !editor .gitignore
master = checkout master
ref = symbolic-ref --short -q HEAD
mktags = !mktags
globalConfig = config --edit --global
aliases = config --get-regexp ^alias\\.

In other cases I don't use abbreviations, because using bash-complete is easier to me.

Collapse
 
devcamilla profile image
Camilla Santiago • Edited

Oh, it's the first I heard of bash complete. Thanks for sharing.

Collapse
 
pkristiancz profile image
Patrik Kristian

lol :) even try CTRL+R for searching in history :)
you guys have some interestig aliases, to be honest, for many of them i am not sure what they do.. time to study i guess :)

Collapse
 
jbazalar profile image
Jason Bazalar • Edited

I like using s for status, o for pull origin, po for push origin and a few other short ones.

However, there was no point in git aliases for me if I didn't alias git as simply g in ~/.bashrc or .~/profile

g s
g bd (branch -d)
g b
g co
g c (commit -m)
g m (merge)

I try to read the letters in my head as the full command so I remember the commands elsewhere.

Collapse
 
vlasales profile image
Vlastimil Pospichal • Edited

In my ~/.bashrc is included:

alias gita='git add'
alias gitb='git branch'
alias gitc='git checkout'
alias gitm='git merge'
alias gitr='git rebase'
alias gits='git status'
Thread Thread
 
devcamilla profile image
Camilla Santiago

This is nice too. Surely there are lots of ways to do this. Thanks for sharing.

Collapse
 
devcamilla profile image
Camilla Santiago

That's a nice touch. Didn't thought of that before. Thanks for sharing.