Skip to content

Instantly share code, notes, and snippets.

@adamlutz
Last active January 23, 2021 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamlutz/b2dc805e664545c7e4e5a54ff3de7516 to your computer and use it in GitHub Desktop.
Save adamlutz/b2dc805e664545c7e4e5a54ff3de7516 to your computer and use it in GitHub Desktop.
config.fish (git)
set -x PATH /opt/homebrew/bin $PATH
set -x PATH /usr/local/bin $PATH
set -x PATH /usr/local/sbin $PATH
set -x PATH ~/bin $PATH
set -x PATH /Applications/Postgres.app/Contents/Versions/latest/bin $PATH
set PATH $HOME/.rbenv/shims $PATH
set PATH $HOME/.rbenv/bin:$PATH
rbenv rehash >/dev/null ^&1
status --is-interactive; and source (rbenv init -|psub)
. $HOME/.config/fish/prompt.fish
set --erase fish_greeting
function reload
source ~/.config/fish/config.fish
end
function ll
ls -lhG $argv
end
function la
ls -lahG $argv
end
function lsd
ls -d */
end
##----GIT------
#alias gs='clear ;and git status -s'
alias gph='git push heroku master'
alias gs='git status -s'
alias gb='git branch'
alias ga='git add . -A'
alias gcb='git checkout -b'
alias gbranch='git rev-parse --abbrev-ref HEAD' #get current branch name
alias gl="clear ;and git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gt='git tag'
alias grm='git rm'
alias gr='git remote -v'
alias gps='git push'
#alias gbi='git bisect'
#alias gbg='git bisect good'
#alias gbb='git bisect bad'
alias gco='git checkout'
alias gm='git merge'
alias gmt='git mergetool'
alias gdt='git difftool'
alias gp='git pull'
alias gpr='git pull --rebase'
alias gup='git stash ;and git pull --rebase ;and git stash apply'
alias grb='git rebase'
alias gri='git rebase -i'
alias gst='git stash'
alias gsta='git stash apply'
alias gunstage='git reset HEAD'
# checkout pull request
function gcopr
git fetch origin pull/$argv/head:pr-$argv ;and git checkout pr-$argv;
end
#commit
function gc
git commit -m "$argv"
end
#cherry-pick
function gcp
git cherry-pick $argv
end
# add
#function ga
# git add $argv
#end
# difftool
function gd
git diff
end
# publish branch to remote repo
function gpub
git push -u origin (gbranch)
end
# open url to github repo
function gopen
open (_getRemoteBranchUrl)
end
# publish branch to remote repo and open url to it in github
function gpubo
gpub ;and gopen
end
# delete remote branch
function gunpub
git push origin :(gbranch)
end
function _getRemote
git config --get remote.origin.url
end
function _getRemoteBranchUrl
set remote (_getRemoteUrl)
set branch (gbranch)
# remote
echo $remote/tree/$branch
end
function _getRemoteUrl
_getRemote | sed -e 's/\(\.git\)*$//g'
end
##----/GIT------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment