Skip to content

Instantly share code, notes, and snippets.

@A99US
Last active May 9, 2023 12:30
Show Gist options
  • Save A99US/bd38f4cb9cef4d4888168d95c9e9b4b4 to your computer and use it in GitHub Desktop.
Save A99US/bd38f4cb9cef4d4888168d95c9e9b4b4 to your computer and use it in GitHub Desktop.
# ---------------------------------------
# General Aliases
# ---------------------------------------
alias profile="nano ~/.bash_profile"
alias prfl="profile"
alias prf="profile"
alias reload="source ~/.bash_profile"
alias rld="reload"
# public IP
alias ip="curl -s http://wtfismyip.com/text"
alias ip1="ip"
alias ip2="curl l2.io/ip"
# ---------------------------------------
# Git Aliases
# ---------------------------------------
alias gs='git status'
alias gss='git status --short'
alias gaa='git add .'
# Git add files individually
function ga() { git add $@; }
# Git commit with message
function gcm() { git commit -m "$@"; }
# Git stage all & commit with message
function gcam() { gaa && git commit -m "$@"; }
# Git stage all & commit with message & push
function gcamp() { gaa && git commit -m "$@" && git push; }
# Git diff HEAD~n HEAD~N-1
function gdh() { git diff HEAD~$1 HEAD~$2; }
# Merge the last 2 commits
function gmerge() { git reset --soft "HEAD^"; git commit --amend -m "$1"; }
# Lazy Commit
alias gimprove='gaa && git commit -m "Little Bit Improvement"'
alias gim='gimprove'
# Git Checkout (gco main . or gco main index.html)
# gco . to pull the latest
function gco() { git checkout $@; }
alias gpull='git fetch --all && git reset --hard FETCH_HEAD'
# alias gpull='git pull'
alias gpush='git push'
alias gpushforce='git push --force'
# Cancel last commit, but keep the changes
alias greset='git reset --soft HEAD~1'
alias gcontributors='git shortlog -sn'
alias gcont='gcontributors'
alias gremote='git remote -v'
# Git Commit List
alias gl='git log'
alias glf='git log --reflog'
alias glo='git log --pretty=format:"%h - %an, %ar : %s"'
alias glo1='glo'
alias glo2='git log --oneline --graph --all'
alias glo3='git log --pretty=oneline'
alias gslo='gs && glo'
# ---------------------------------------
# NPM Aliases
# ---------------------------------------
alias nu='npm update'
alias ni='npm install'
function nr() { npm run $@; }
# ---------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment