#DEV My #Git Aliases



I use git every day, every time I can.
Here is my list with some comments

git config --global alias.aa 'add --all'
git config --global alias.ba 'branch --all'
git config --global alias.ci 'commit'
git config --global alias.cm 'commit -m'
git config --global alias.co 'checkout'
git config --global alias.cp 'cherry-pick'

git config --global alias.d1 'diff --name-only HEAD~1 HEAD'
d1 = diff with one previous commit

git config --global alias.dd 'diff HEAD..develop --name-status'
dd = diff with develop

git config --global alias.dm 'diff HEAD..master --name-status'
dm = diff with master

git config --global alias.fp 'fetch --prune'
git config --global alias.ld 'log -p -2'
git config --global alias.lo 'log -10 --date=short --oneline'
git config --global alias.pab 'push --all origin'
pab = push all branches (maybe dangerous)

git config --global alias.poh 'push origin HEAD'

git config --global alias.pr 'pull --rebase'
pr = pull rebase (I always pull rebase)

git config --global alias.pt 'push origin --tags'
git config --global alias.rh 'reset HEAD --'

To stash or not to stash :


git config --global alias.sa 'stash apply --index'
git config --global alias.sl 'stash list'

Git-flow:

I use git-flow heavily :
git config --global alias.fi 'flow init -d'
fi = flow init (with default branch names)
git config --global alias.fff 'flow feature finish'
git config --global alias.ffs 'flow feature start'
git config --global alias.frf 'flow release finish'
git config --global alias.frs 'flow release start'


and the most used one : git config --global alias.st 'status'

Another useful command

git config --global --edit 
to edit all your aliases in one place

What about you ?

Do you use git command line ? Have you configured aliases ? Which ones ?

Commentaires