Skip to content

Instantly share code, notes, and snippets.

@DwordPtr
Created December 21, 2017 03:16
Show Gist options
  • Save DwordPtr/371c13c887b7349680bb3f446beb628c to your computer and use it in GitHub Desktop.
Save DwordPtr/371c13c887b7349680bb3f446beb628c to your computer and use it in GitHub Desktop.
my git aliases
#git aliases
alias grset='git reset HEAD --hard'
alias lsha="git log -1 | top | awk '{print $2}'"
alias sb='git rev-parse --abbrev-ref HEAD'
function git_add_tracked(){
if [[ $# -eq 0 ]] ; then
git ls-files --modified | xargs git add
else
git ls-files --modified | grep "$@" | xargs git add
fi
}
function git_commit_method(){
if [[ $# -eq 0 ]] ; then
git commit
else
git commit -m "$@" #this doesn't work yet
fi
}
#get commits on a ticket
function find_ticket_commits(){
if [[ $# -eq 0 ]] ; then
echo noargs srsly
else
git log --author=btidwell --grep=$1 -i
fi
}
alias fct='find_ticket_commits'
alias gc='git_commit_method'
alias gck='git checkout'
alias gmast='git checkout master'
alias gatrac='git_add_tracked'
alias gunad='git reset HEAD'
alias gad='git add --a'
alias gpullr='git pull --rebase origin $(sb)'
alias gpull='git pull origin $(sb)'
alias gs='git status'
alias gr='git reset'
alias gpsh='git push origin $(sb)'
alias glb='git branch -a'
alias url='git config --get remote.origin.url'
#pullNpush
alias gplsh='gpullr && gpsh'
alias gdiff='git difftool --tool=meld'
alias diff='git difftool --tool=meld --dir-diff'
alias stash='git stash' #make function for including ticket number
alias apply='git stash apply'
alias drop='git stash drop'
alias list='git stash list'
alias curr='git log -1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment