Skip to content

Instantly share code, notes, and snippets.

@austenc
Last active December 13, 2018 04:18
Show Gist options
  • Save austenc/548a47936439e26622c55011fd7c31ad to your computer and use it in GitHub Desktop.
Save austenc/548a47936439e26622c55011fd7c31ad to your computer and use it in GitHub Desktop.
Mac OS based .bash_profile with powerline stuff included
# Powerline
# https://github.com/powerline/powerline
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
source /usr/local/lib/python3.7/site-packages/powerline/bindings/bash/powerline.sh
# Add the global composer install directory to our PATH
export PATH=${PATH}:~/.composer/vendor/bin
# Enable git autocomplete, first make sure homebrew is installed,
# then run `brew install git bash-completion`
# make sure you do not miss the "git" part of the command!
source /usr/local/etc/bash_completion.d/git-completion.bash
# Directory / Navigation aliases
alias ..='cd ..'
alias ...='cd ...'
alias core='cd ~/Code/bedrock/core'
alias 406io='cd ~/Code/406io'
alias ccl='cd ~/Code/ccl/web/app/themes/crystalcreek'
# Webdev aliases
alias artisan='php artisan'
alias art='php artisan'
alias lreset='rm -rf ./vendor && composer install && npm ci && npm run dev'
alias tower='php ~/Code/tower/artisan/tower'
alias phpunit='vendor/bin/phpunit'
# Git command aliases
alias gac='git add . && git commit'
alias gs='git status'
alias gl='echo "Showing last 12 commits..." && git log --oneline --max-count="12"'
alias gd='git diff'
alias gc='git commit'
alias ga='git add'
alias gp='git pull'
alias gb='git branch'
alias gpu='git push'
alias gm='git merge'
alias gco='git checkout'
alias nah='git reset --hard && git clean -df'
# Allow bash completion on above aliases
__git_complete gco _git_checkout
__git_complete gb _git_branch
__git_complete gm _git_merge
__git_complete gp _git_pull
__git_complete gpu _git_push
# Some more Git aliases from https://gist.github.com/robmiller/6018582
# Get the current branch name (not so useful itself, but used in other aliases):
alias branch-name='git rev-parse --abbrev-ref HEAD'
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
function pub {
[[ $(git config branch.$(git symbolic-ref --short HEAD).merge) = '' ]] && git push -u origin $(git symbolic-ref --short HEAD) || git push
}
# Delete the remote version of the current branch
alias unpub='git push origin :$(branch-name)'
# Unstage any files that have been added to the staging area
alias unstage='git reset HEAD'
# Delete any branches that have been merged into master
# See also: https://gist.github.com/robmiller/5133264
alias dmb="gco master && gb --merged | grep -v '\*' | xargs -n 1 git branch -d"
# Open dev setup for the current project / folder
function dev() {
cd ~/Code/${1:-$PWD} && code . && npm run watch;
}
# Open the github pull request page for current branch or passed in argument
function gpr() {
github_url=`git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@' -e 's%\.git$%%'`;
branch_name=`git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3`;
pr_url=$github_url"/compare/${1:-master}..."$branch_name
open $pr_url;
}
# Start a new laravel project with austenc/preset
function newapp() {
composer create-project laravel/laravel ${1:-newapp}
cd ${1:-newapp}
composer require austenc/preset --dev
art preset austencam
npm i && npm run dev
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment