Skip to content

Instantly share code, notes, and snippets.

@jmmaranan
Last active November 24, 2019 04:48
Show Gist options
  • Save jmmaranan/a7fc057f86d2c8867d82cf3f03e81313 to your computer and use it in GitHub Desktop.
Save jmmaranan/a7fc057f86d2c8867d82cf3f03e81313 to your computer and use it in GitHub Desktop.
saving my .bashrc
##############################################
# terminal prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
##############################################
# SSH AGENT
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new 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;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
##############################################
# GIT SHORTCUTS
alias gitprojects='mkdir -p $HOME/Workspace/GitProjects && cd $HOME/Workspace/GitProjects'
alias ll='ls -la'
alias gs='git status'
alias gl='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\'\'' --abbrev-commit'
alias ga='git add .'
alias gfpa='git fetch --all --prune'
alias grso='git remote show origin'
alias gda='git diff --ws-error-highlight=all'
##############################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment