Skip to content

Instantly share code, notes, and snippets.

@chrisjordanme
Last active October 26, 2016 20:05
Show Gist options
  • Save chrisjordanme/8435587 to your computer and use it in GitHub Desktop.
Save chrisjordanme/8435587 to your computer and use it in GitHub Desktop.
My .bash_profile These configurations may or may not be useful for you. Customize to your needs...
# $PATH exports
# Android SDK to $PATH
export PATH=/usr/local/bin:/Users/chrisjordan/Documents/dev-resources/git-tf:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home:~/Documents/dev-resources/adt-bundle-mac-x86_64-20140702/sdk/platform-tools:~/Documents/dev-resources/adt-bundle-mac-x86_64-20140702/sdk/tools:$PATH
export JAVA_HOME=$(/usr/libexec/java_home) #Added for Apache Maven installation
# Change this to your mac username
USER=chrisjordan
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
#MySQL
alias sqlstart="cd /usr/local/mysql/support-files; mysql.server start"
alias sqlstop="cd /usr/local/mysql/support-files; mysql.server stop"
# Gulp
# alias gulp="./node_modules/.bin/gulp"
#grunt shortcuts
alias serve="grunt serve"
# General Shortcuts & Utility Functions
alias doc="cd /Users/$USER/Documents; ls -a"
alias sites="cd /Users/$USER/Sites; ls -a"
alias desk="cd /Users/$USER/Desktop; ls -a"
alias trash="rm -rf ~/.Trash/*" #force empty the trash
#refreshes terminal without requiring a restart after profile changes
alias bashrefresh=". ~/.bash_profile"
alias editbash="atom ~/.bash_profile" # Depends on Atom Editor -- will launch this script in Atom so you can easily edit. If you don't want atom, change atom to vi
# aws command redirects to where ec2 pem files are located for easy ssh
alias aws="cd /Users/$USER/Documents/dev-resources/ec2-pems"
#show / hide hidden files in Finder
function show() {
defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder
}
function hide() {
defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder
}
### GIT SHORTCUTS ###
# sources the gitprompt.sh file from: https://github.com/magicmonty/bash-git-prompt
### !!! Important: You must have the repo above cloned into the location listed here for this to work!
. ~/Documents/dev-resources/bash/bash-git-prompt/gitprompt.sh
alias status="git status"
alias pull="git pull" # fetch/merge
alias pullr="git pull --rebase" # pull with rebase. useful for pulling in remote changes to your same branch
alias remotes="git branch -r" # List remote branches
alias showOrigin="git remote show origin"
alias tags="git tag"
alias branch="git branch" # List local branches
alias add="git add ."
alias addall="git add -u"
alias graph="git log --oneline --graph --color --all --decorate"
# Performs a hard reset. Careful when using this.
alias reset="git reset --hard HEAD"
# where $* equals your input for each of these functions
function push() { # push changes to remote branch
git push origin "$*"
}
function makeb() { # Creates a new local branch
git checkout -b "$*"
}
function killb() { # Deletes a local git branch
git branch -D "$*"
}
function killRemote() { # Delete remote branch
git push origin --delete "$*"
}
function clone() { # clone a repo
git clone "$*"
}
function commit() { # shortcut to commit
git commit -m "$*"
}
function checkout() { # switch to branch branchName
git checkout "$*"
}
function pushRemote() { # Push a new local branch to the remotes
git push -u origin "$*"
}
function tag() { # create an annotated tag $1 = tag name $2 = message
git tag -a "$1" -m "$2"
}
function pushTag() { # Push a specific tag to remotes
git push origin "$*"
}
function pushTags() { # push all the tags
git push --tags
}
function archive() { # Creates a zip file while stripping out git metadata
git archive "$1" --format zip --output "$2"
}
# Random Stuffs. These are pretty unuseful to be honest...
function google() { #initiate Google search from terminal
open /Applications/Google\ Chrome.app/ "http://www.google.com/search?q= $1";
}
function go() { #launch some webpage.
open /Applications/Google\ Chrome.app/ "http://$1.com"
}
alias gists="open /Applications/Google\ Chrome.app/ https://gist.github.com/chrisjordanme"
[ -s "/Users/cjorda/.dnx/dnvm/dnvm.sh" ] && . "/Users/cjorda/.dnx/dnvm/dnvm.sh" # Load dnvm
@chrisjordanme
Copy link
Author

Dependencies & Quirks

First, you may not want some of this. And that's cool. I just like to keep a hosted copy here of my preferred configuration. Please change to suit your needs. My hope is that bits of this will be helpful for you.

Changing your username:

A few aliases here depend on specific mac username. To add yours, change the variable on line 6.

For true bash pimping:

See line 39 of the file. It is important that you clone this repo:

bash-git-prompt

Clone it to any location on your system and then point line 41 to that place. Specifically, to gitprompt.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment