Zshrc config
My custom aliases for git and other commands, really useful.
First, open zhrc file config
code ~/.zshrc
vim ~/.zshrc
nano ~/.zshrc
touch ~/.zshrc
Command Aliases
# FILE ALIASES -------------------------------------
alias vzsh="code ~/.zshrc"
alias szsh="source ~/.zshrc"
# COMMAND FUNCTIONS -----------------------------------
function goto {
cd ~/pr/$1
}
# COMMAND ALIASES -------------------------------------
alias p="pnpm"
alias px="pnpm dlx" # download and execute
alias pex="pnpm exec" # execute from dependencies
alias pcache="pnpm store prune" # delete all cache files from pnpm
alias vzsh="cursor ~/.zshrc"
alias szsh="source ~/.zshrc"
alias vzshthemes="cursor ~/.oh-my-zsh/themes"
alias vzshplugins="cursor ~/.oh-my-zsh/plugins"
alias ll="ls -la"
alias cpdir='pwd|tr -d "\n"|pbcopy'
alias c="clear"
alias path="echo -e ${PATH//:/\\n} ;"
Git Aliases
# GIT ALIASES -----------------------------------------
alias gg="git"
alias ggi="git init" # create .git file
alias gga="git add" # add file to stage
alias ggc="git commit -m" # commit stage files with message
alias ggp="git push origin $(git_current_branch)"
function ggpush {
git add .
git commit -m "$1"
git push origin $(git_current_branch)
}
alias ggf="git fetch -all"
alias ggmerge="git merge" # Merging another-branch($1) to current branch
alias ggpull='git pull origin' # fetch + merge from remote-branch($1) to current branch # git pull [remote] [branch]
alias ggcancelmerge="git merge --abort"
alias ggdelete='git branch -d' # Delete branch, ususally used after merge
alias ggco='git checkout' # travel to another existing branch, or main by default
alias ggrebase="git rebase -i"
alias ggstat="git status" # list files not staged
alias gglog='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all'
alias ggbranch="git branch -a" # list all branches
alias ggconflict='git diff' # list conflicts to be resolved
# start new feature($1) from branch($2)
function ggfeat {
git checkout -b "$1" "$2"
}