Skip to content

Instantly share code, notes, and snippets.

@Alejandroacho
Last active July 26, 2022 08:18
Show Gist options
  • Save Alejandroacho/958915c99b2a5445e62cb7a2554d0c30 to your computer and use it in GitHub Desktop.
Save Alejandroacho/958915c99b2a5445e62cb7a2554d0c30 to your computer and use it in GitHub Desktop.
Terminal alias
# Bash
alias ll='ls -a'
alias c='clear'
alias rcache="find . | grep -E '(__pycache__|\.pyc|\.pyo$)' | xargs rm -rf && find . | grep -E '(.pytest_cache|\.pyc|\.pyo$)' | xargs rm -rf "
# Projects
alias up='make local'
alias run='npm run local'
alias rund='npm run dev'
alias down='make local-stop'
alias m='make'
alias reconstruct-dev="cd /Users/alejandro/Desktop/Repos/core-backend && SETTINGS='--settings=settings.settings.dev' m db-recreate"
alias tflush='make test-db-flush'
alias cypress='npm run cypress:open'
test() {APP="$@" make test-all}
ftest() {make test-db-flush && APP="$@" make test-all}
rtest() {make test-db-recreate && APP="$@" make test-all}
shell() {
if [ ! -z "$@" ]; then
echo "************************************************"
echo "* !! WARNING; RUNING ON $@ ENVIRONMENT !! *"
echo "************************************************"
docker exec -it core_backend bash -c "python manage.py shell_plus --settings=settings.settings.$@"
else
echo "RUNNING IN DEV ENVIRONMENT"
make shell
fi
}
urls() {
if [ ! -z "$@" ]; then
GREP="$@" make show_urls
else
make show_urls
fi
}
# Git
alias g='git'
alias gs='git status'
alias gd='git diff'
alias gc='git commit -m'
alias gb='git branch'
alias gout='git checkout'
alias goutb='git checkout -b'
alias dev='git checkout dev'
alias push='git push origin'
alias pull='git pull origin'
alias staged='git restore --staged'
alias restore='git restore'
alias stashc='git stash clear'
alias stashl='git stash list'
stashp() {
if [ ! -z "$@" ]; then
git stash pop stash@{"$@"}
else
git stash pop
fi
}
stash() {
if [ ! -z "$@" ]; then
git stash save "$@"
else
git stash
fi
}
stasha() {
if [ ! -z "$@" ]; then
git stash apply stash@{"$@"}
else
git stash apply
fi
}
undo() {
if [ ! -z "$@" ]; then
git reset --soft HEAD~"1"
else
git reset --soft HEAD~"$@"
fi
}
# Docker
alias d='docker'
alias dps='docker ps'
alias dcps='docker-compose -f docker-compose.local.yml ps'
alias bash='make bash'
alias prune='docker system prune -a --volumes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment