Skip to content

Instantly share code, notes, and snippets.

@DanielHoffmann
Created December 20, 2019 17:26
Show Gist options
  • Save DanielHoffmann/45b09d8cd609c9b6288fb0cbf0261334 to your computer and use it in GitHub Desktop.
Save DanielHoffmann/45b09d8cd609c9b6288fb0cbf0261334 to your computer and use it in GitHub Desktop.
export GOPATH=/Users/danielhoffmannbernardes/dev/go
# ZSH stuff
export ZSH=/Users/danielhoffmannbernardes/.oh-my-zsh
ZSH_THEME="robbyrussell"
plugins=(
git
)
source $ZSH/oh-my-zsh.sh
# add "code" bin to PATH
export PATH=$PATH:/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin
# sets default editor to be nano instead of vim for cli
export EDITOR='nano'
export VISUAL='nano'
unalias jira_code project_name branch_name gs ga gaa gr grh gd gdf gc gaac gp gl gcheck gcheckbranch gb gbd gf gpull gt google jira jirab stash gdd 2> /dev/null sg
alias sg='grep $1 --context=3'
alias branch_name='git rev-parse --abbrev-ref HEAD'
alias jira_code='git rev-parse --abbrev-ref HEAD | egrep -o "^(.*\/)?([A-Za-z]{0,4}-[0-9]{0,5})" | egrep -o "([A-Za-z]{0,4}-[0-9]{0,5})" | head -n 1'
alias project_name='basename `git rev-parse --show-toplevel`'
alias gs='git status'
alias ga='git add'
alias gaa='git add --all'
alias gr='git reset'
alias grh='git reset --hard'
alias gd='git diff'
gdf() { git diff '*'$1'*'; }
gdd() { git diff origin/develop -- '*'$1'*' }
gc() {
local JIRA_CODE="$(jira_code)"
git commit -m "$JIRA_CODE $*";
}
gaac() {
git add --all;
local JIRA_CODE="$(jira_code)"
git commit -m "$JIRA_CODE $*";
}
alias gp='git push'
alias gl='git log --decorate --graph --date=relative'
alias gcheck='git checkout'
gcheckbranch() { git checkout -b $1 origin/$1; }
alias gb='git branch'
alias gbd='git branch -d'
alias gf='git fetch'
alias gpull='git pull'
alias gt='git tag'
github() {
local PROJECT_NAME="$(project_name)"
local BRANCH_NAME="$(branch_name)"
open "https://github.com/sandvikcode/$PROJECT_NAME/tree/$BRANCH_NAME"
}
gpr() {
local BRANCH_NAME="$(branch_name)"
local PROJECT_NAME="$(project_name)"
open "https://github.com/sandvikcode/$PROJECT_NAME/compare/$BRANCH_NAME?expand=1"
}
google() {
open "https://www.google.se/search?q=$1"
}
jirab() {
open "https://allting.atlassian.net/secure/RapidBoard.jspa?rapidView=37&projectKey=SFP"
}
jira() {
local JIRA_CODE="$(jira_code)" 2> /dev/null;
if [ -z "$JIRA_CODE" ]
then
$(jirab);
else
open "https://allting.atlassian.net/browse/$JIRA_CODE";
fi
}
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment