Last active
July 8, 2022 13:31
-
-
Save thinkricardo/dafd4ff594060a7a0ef899e569da881c to your computer and use it in GitHub Desktop.
Git commands aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ,fetch="git fetch" | |
alias ,pull="git pull" | |
alias ,push="git push" | |
alias ,pushu="git push --set-upstream origin HEAD" | |
alias ,prune="git remote prune origin" | |
alias ,gone="git branch -vv | awk '/^ .*gone/{print \$1}' | xargs -r git branch -d" | |
alias ,undo="git reset --soft HEAD~1" | |
alias ,last="git --no-pager log --oneline -15" | |
alias ,branches="git --no-pager branch -v" | |
alias ,stashes="git stash list" | |
alias ,previous="git checkout -" | |
alias ,develop="git checkout develop" | |
alias ,master="git checkout master" | |
alias ,refresh-master="git-refresh-repository master" | |
alias ,refresh-develop="git-refresh-repository develop" | |
alias ,merge-master="git-merge-current-branch-with master" | |
alias ,merge-develop="git-merge-current-branch-with develop" | |
function git-refresh-repository() { | |
echo ${(%):-%F{cyan}}Switch to branch "$@"${(%):-%f} | |
eval ",$@" | |
echo ${(%):-%F{cyan}}Fetch changes${(%):-%f} | |
,fetch | |
echo ${(%):-%F{cyan}}Pull changes${(%):-%f} | |
,pull | |
echo ${(%):-%F{cyan}}List stashes${(%):-%f} | |
,stashes | |
echo ${(%):-%F{cyan}}Prune branches${(%):-%f} | |
,prune | |
echo ${(%):-%F{cyan}}Delete pruned branches${(%):-%f} | |
,gone | |
echo ${(%):-%F{cyan}}List branches${(%):-%f} | |
,branches | |
} | |
function git-merge-current-branch-with() { | |
echo ${(%):-%F{cyan}}Switch to branch "$@"${(%):-%f} | |
eval ",$@" | |
echo ${(%):-%F{cyan}}Fetch repository${(%):-%f} | |
,fetch | |
echo ${(%):-%F{cyan}}Pull changes${(%):-%f} | |
,pull | |
echo ${(%):-%F{cyan}}Switch to previous branch${(%):-%f} | |
,previous | |
echo ${(%):-%F{cyan}}Merge with develop${(%):-%f} | |
eval "git merge $@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment