Best Git Alias using ohmyzsh

Motivation
Being a productive developer is really important, not only is it enough to know a language and be an expert, being able to optimize time as much as possible can make us work better and of course stand out, to achieve this, reducing the time of each small task can be a first step. Git is the day to day of all of us as developers, so if we can reduce this time a bit it is a great advance towards the goal of being more productive.
A good idea to save time when typing in the console is to create aliases, this allows you not to write very long commands, in this case you can set some aliases to replace it and write something shorter.
Oh-my-Zsh
When I started using 'ohmyzsh' I did it because I think it's amazing how we can set up your term and use it as you prefer, customize it, or use themes. But I found that 'ohmyzsh' not only comes with a nice visual setup, it comes with a nice list of aliases, already configured and ready to use.
My favorites
This is my favorites aliases, this are my day-on-day with git, so if you have already installed 'ohmyzsh' this could be useful to you.
Working with commits:
# looking the files state
git state
# using 'ohmyzsh' alias
gst
# adding all files to staged area
git add .
# using 'ohmyzsh' alias
ga .
# create a commit
git commit -m '<comment>'
# using 'ohmyzsh' alias
gc -m '<comment>'
Working with github
# getting changes from github
git pull origin $(current_branch)
# using 'ohmyzsh' alias
ggl
# sending changes to github
git push origin $(current_branch)
# using 'ohmyzsh' alias
ggp
Working with branches
# getting the list of branches
git branch
# using 'ohmyzsh' alias
gb
# Moving to other branch or commit
git checkout '<branch-name || commit hash>'
# using 'ohmyzsh' alias
gco '<branch-name || commit hash>'
# Make a new branch and move to it
git checkout -b '<branch-name>'
# using 'ohmyzsh' alias
gcb '<branch-name>'
Working with the commits history
# looking the history
git log --oneline --decorate --graph
# using 'ohmyzsh' alias
glog
# rebasing the history
git rebase '<branch-name>'
# using 'ohmyzsh' alias
grb
# continue after resolve rebase conflicts
git rebase --continue
# using 'ohmyzsh' alias
grbc
# merge branches
git merge
# using 'ohmyzsh' alias
gm
# moving commits using cherry-pick
git cherry-pick
# using 'ohmyzsh' alias
gcp
# continue after resolve cherry-pick conflicts
git cherry-pick --continue
# using 'ohmyzsh' alias
gcpc
There is another command I want to give you!
When we work in a professional environment we can have many branches that we no longer use, so it is good practice to clean them from time to time.
This command allows us to clean the branches who are currently merged with the main branch.
git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -d
For this large command you can make a custom alias, adding the follow code to ~/.zshrc
alias gbclean='git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -d'
By doing this you have to reset your term and then you can white gbclean
and it will remove all the "old" branches.
To know more in deep how that command works, check out this good article: https://lavaldi.com/limpiar-ramas-locales-git/
Full list of aliases
If you want to know all the aliases 'ohmyzsh' has, take a look here:
https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet