Last active
November 8, 2018 02:28
-
-
Save bwillis/4662580 to your computer and use it in GitHub Desktop.
Git and Github commands I use via .zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git commands | |
# ggh - git url: get the url to the current github repo (assumes it's the remote push server) | |
# ggbn - git branch name: get the name of the current branch | |
# ggwip - git wip: commit the current staged and unstaged files with a commit message of WIP | |
# ggundo - git undo: pull the last commit off as staged changes | |
# ggbh - git branch history: list the 6 recent branches by commit date | |
# ggbs - git branch smart history: list the 6 recent branches by commit date without master, staging or production | |
# ggbl - git branch last: get the last branch that is not master, staging or production | |
alias ggh="git remote -v 2> /dev/null | grep push | awk '{print \$2}' | sed 's/:/\//' | sed 's/git@\(.*\)\.git/https:\/\/\1/'" | |
alias ggbn="git branch 2> /dev/null | grep -e '^*' | awk '{print \$2}'" | |
alias ggwip="git add .;git commit -am \"WIP\"" | |
alias ggundo="git reset HEAD~1" | |
alias ggbh="git for-each-ref --count=6 --sort=-committerdate refs/heads/ --format='%(refname:short)'" | |
alias ggbs="ggbh | grep -E 'bug|feature'" | |
alias ggbl="git co \$(ggbs | head -n1)" | |
# Github integration commands | |
# ggho - github open: open the current github repo | |
# ggbo - github open branch: open the branch in github | |
alias ggho="open \$(ggh)" | |
alias ggbo="open \"\$(ggh)/tree/\$(ggbn)\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment