Created
October 11, 2017 17:49
-
-
Save sally/e7abb39db0bfb1459d9c3dcdf9294788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# echo is like puts for bash (bash is the program running in your terminal) | |
echo "Loading ~/.bash_profile a shell script that runs in every new terminal you open" | |
# $VARIABLE will render before the rest of the command is executed | |
echo "Logged in as $USER at $(hostname)" | |
# Load git completions | |
git_completion_script=/usr/local/etc/bash_completion.d/git-completion.bash | |
test -s $git_completion_script && source $git_completion_script | |
# A more colorful prompt | |
# \[\e[0m\] resets the color to default color | |
c_reset='\[\e[0m\]' | |
# \e[0;31m\ sets the color to red | |
c_path='\[\e[0;31m\]' | |
# \e[0;32m\ sets the color to green | |
c_git_clean='\[\e[0;32m\]' | |
# \e[0;31m\ sets the color to red | |
c_git_dirty='\[\e[0;31m\]' | |
# PS1 is the variable for the prompt you see everytime you hit enter | |
PROMPT_COMMAND='PS1="${c_path}\W${c_reset}$(git_prompt) :> "' | |
export PS1='\n\[\033[0;31m\]\W\[\033[0m\]$(git_prompt)\[\033[0m\]:> ' | |
# determines if the git branch you are on is clean or dirty | |
git_prompt () | |
{ | |
if ! git rev-parse --git-dir > /dev/null 2>&1; then | |
return 0 | |
fi | |
# Grab working branch name | |
git_branch=$(Git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') | |
# Clean or dirty branch | |
if git diff --quiet 2>/dev/null >&2; then | |
git_color="${c_git_clean}" | |
else | |
git_color=${c_git_dirty} | |
fi | |
echo " [$git_color$git_branch${c_reset}]" | |
} | |
# Colors ls should use for folders, files, symlinks etc, see `man ls` and | |
# search for LSCOLORS | |
export LSCOLORS=ExGxFxdxCxDxDxaccxaeex | |
# Force ls to use colors (G) and use humanized file sizes (h) | |
alias ls='ls -Gh' | |
# Force grep to always use the color option and show line numbers | |
export GREP_OPTIONS='--color=always' | |
# Useful aliases (Hunter) | |
alias a=atom | |
alias g=git | |
alias c="clear" | |
alias gb="git branch" | |
alias gpo="git push origin" | |
alias gph="git push heroku" | |
# Useful aliases (Sally) | |
alias f="open -a Finder ./" | |
alias gs="git status" | |
alias ga="git add" | |
alias gc="git commit -m" | |
alias gacm="git add . && git commit -m" | |
alias gco="git checkout" | |
alias gprune="git branch | grep -v 'master' | xargs git branch -D" | |
alias greset="git fetch origin && git reset --hard origin/master && git clean -f -d" | |
function add_pr_remotes() { | |
mv .git/config .git/config-orig | |
awk '/remote "origin"/ { | |
print $0 | |
getline; | |
print $0 | |
getline; | |
print $0 | |
print "\tfetch = +refs/pull/*/head:refs/remotes/origin/pr/*" | |
}1' .git/config-orig > .git/config | |
git fetch origin | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment