This is an environment file to source upon shell startup (via .bashrc/.bash_profile or your shell's corresponding file). If your shell isn't Bash you will likely need to port the functions to your shell's syntax.
When inside your local Git clone of a Github repo you need to do the following (only once per repo):
git config --add github.repo "user/repo-name"
So in this case you are saying your Github repo is found at https://github.com/user/repo-name.
When inside your local repo you can do the following:
ghrepourl # => https://github.com/user/repo-name
ghbranchurl # => https://github.com/user/repo-name/branches/
ghbranchurl my-feature-branch # => https://github.com/user/repo-name/branches/my-feature-branch
ghtagsurl # => https://github.com/user/repo-name/tags
ghcompurl SHA1 SHA2 # => https://github.com/user/repo-name/compare/SHA1...SHA2
ghcommiturl SHA1 # => https://github.com/user/repo-name/commit/SHA1
ghsearchcode KEYWORDS # => https://github.com/user/repo-name/search?q=KEYWORDS
ghsearchlogs KEYWORDS grep # => https://github.com/user/repo-name/search?q=KEYWORDS&choice=grep
ghsearchlogs KEYWORDS author # => https://github.com/user/repo-name/search?q=KEYWORDS&choice=grep
ghsearchlogs KEYWORDS committer # => https://github.com/user/repo-name/search?q=KEYWORDS&choice=grep
ghsearchlogs KEYWORDS code # => https://github.com/user/repo-name/search?q=KEYWORDS&choice=grep
ghsearchauthor KEYWORDS # => https://github.com/user/repo-name/search?q=KEYWORDS&choice=author
ghsearchcommitter KEYWORDS # => https://github.com/user/repo-name/search?q=KEYWORDS&choice=committer
When running tig
in your local clone, if you have already added the following to your ${HOME}/.tigrc
file then you can do the following:
bind diff O !open $(ghcommiturl %(commit))
bind main O !open $(ghrepourl)
bind branch O !open $(ghbranchurl %(branch))