Skip to content

Instantly share code, notes, and snippets.

@numencode
Last active June 8, 2016 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numencode/3ce8d0f9b386ab2342ec0a0c2c5ff728 to your computer and use it in GitHub Desktop.
Save numencode/3ce8d0f9b386ab2342ec0a0c2c5ff728 to your computer and use it in GitHub Desktop.
BASH Setup - BashRC & Aliases for Git use
# CUSTOM
alias www='cd d:/www'
# FILE/FOLDER MANAGING
alias root='cd ~/'
alias cd..='cd ..'
alias ll='ls -lah'
alias md='mkdir'
alias rd='rm -rf'
alias rm='rm -i'
alias edit='vi'
alias rename='mv'
alias new='touch'
alias clr='clear'
alias cls='clear'
# SYSTEM RELATED
alias vialias='vi ~/.bash_aliases'
alias showalias='cat ~/.bash_aliases'
alias vietc='vi c:/Windows/System32/drivers/etc/hosts'
alias showetc='cat c:/Windows/System32/drivers/etc/hosts'
alias delc='rm c:/Users/User/AppData/Local/Temp/cache/* -f'
# GIT
alias add='git add --all'
alias com='git commit -m'
alias cam='git commit --amend'
alias remote='git remote add origin'
alias push='git push -u origin master'
alias pull='git pull origin master'
alias rebase='git rebase origin/master'
alias fetch='git fetch --all --prune --verbose --progress'
alias branch='git checkout -b'
alias switch='git checkout'
alias diff='git diff'
alias gst='git status'
alias gstr='git remote update && git status'
alias log='git log --pretty=oneline'
# SSH Environment
# SSH_ENV=$HOME/.ssh/environment
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Don't put duplicate lines in the history. See bash(1) for more options
# export HISTCONTROL=ignoredups
# Check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# The prompt information
export PS1="\[\e[00;33m\]\u\[\e[0m\]\[\e[00;37m\]@\h:\[\e[0m\]\[\e[00;36m\][\[\e[0m\]\[\e[00;33m\]\w\[\e[0m\]\[\e[00;36m\]]\[\e[0m\]\[\e[00;37m\]\$(parse_git_branch): \[\e[0m\]"
# Leave some commands out of history log
export HISTIGNORE="&:??:[ ]*:clear:exit:logout"
# Default editor
export EDITOR=vi
# Define color to additional file types
export LS_COLORS=$LS_COLORS:"*.wmv=01;35":"*.wma=01;35":"*.flv=01;35":"*.m4a=01;35"
# Alias definitions
# Enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
fi
# User-defined aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Enable programmable completion features (you don't need to enable this,
# if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# Start the SSH-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add
}
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
# GIT repository - parse branch name
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment