Skip to content

Instantly share code, notes, and snippets.

@bluehazetech
Created March 31, 2014 00:41
Show Gist options
  • Save bluehazetech/9882820 to your computer and use it in GitHub Desktop.
Save bluehazetech/9882820 to your computer and use it in GitHub Desktop.
Dotfile: bashrc (Windows)
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
agent_is_running() {
if [ "$SSH_AUTH_SOCK" ]; then
# ssh-add returns:
# 0 = agent running, has keys
# 1 = agent running, no keys
# 2 = agent not running
ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ]
else
false
fi
}
agent_has_keys() {
ssh-add -l >/dev/null 2>&1
}
agent_load_env() {
. "$env" >/dev/null
}
agent_start() {
(umask 077; ssh-agent >"$env")
. "$env" >/dev/null
}
if ! agent_is_running; then
agent_load_env
fi
if ! agent_is_running; then
agent_start
ssh-add
elif ! agent_has_keys; then
ssh-add
fi
unset env
#-------------------------------------------------------------------------------
# Grunt tab auto-completion
#-------------------------------------------------------------------------------
# eval "$(grunt --completion=bash)"
#-------------------------------------------------------------------------------
# Bash Prompt
#-------------------------------------------------------------------------------
PS1='\[\033]0;$MSYSTEM:\w\007\]\n\e[1;30m\u@\h \e[0;36m\w\e[1;36m$(__git_ps1)\e[0m\n$ '
#-------------------------------------------------------------------------------
# Aliases
#-------------------------------------------------------------------------------
alias subl='/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe'
alias aliases='source ~/.bashrc'
alias browse='explorer .'
#-------------------------------------------------------------------------------
# Project Aliases
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Git Aliases
#-------------------------------------------------------------------------------
alias g='git'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gst='git status'
alias gsts='git status -s'
alias gb='git branch'
alias gba='git branch -a'
alias gfa='git fetch --all'
alias gc='git commit -m'
alias gca='git commit --amend --no-edit'
alias gcundo='git reset --soft HEAD^'
alias gstash='git stash'
alias gstashp='git stash pop'
alias gstashl='git stash list'
alias gstashd='git stash drop'
alias gstashshow='git stash show -p stash@'
alias gstash0='git stash show -p stash@{0}'
alias gcp='git cherry-pick'
alias ga='git add'
alias gau='git add -u'
alias gundoa='git reset HEAD'
alias gp='git push origin HEAD'
alias gpo='git pull origin'
alias gmg='git mergetool'
alias gdiff='git diff --color-words'
alias gdifft='git difftool'
alias gcfg='git config -l'
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 gll='git log --stat --abbrev-commit'
alias glf='git log --raw --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset" --abbrev-commit --'
alias glodg='git log --oneline --decorate --graph'
alias glodgs='git log --oneline --decorate --graph --stat'
alias glg='git log --graph --abbrev-commit --pretty=format:"%Cred%h%Creset %C(blue)<%ae>%Creset"'
alias glgs='git log --graph --stat --pretty=format:"%Cred%h%Creset - %C(blue)<%ae>%Creset, %ar %C(yellow)%d%Creset : %s"'
#-------------------------------------------------------------------------------
# Key Bindings
#-------------------------------------------------------------------------------
bind '"\eOC":forward-word' # Ctrl+Right
bind '"\eOD":backward-word' # Ctrl+Left
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment