Today I Learned

A Hashrocket project

See the source and location for bash commands

The oh-my-zsh package comes with a lot of useful plugins. Often those plugins add bash functions to the global scope.

If you want to see where the function is defined you can use the type command.

For example the new_gh/exist_gh command which creates a remote repo for a folder

$ type exist_gh
exist_gh is a shell function from /Users/dkarter/.oh-my-zsh/plugins/github/github.plugin.zsh

To see the function source use the declare command:

$ declare -f new_gh
new_gh () {
        cd "$1"
        ghuser=$( git config github.user )
        git init
        print '.*'"\n"'*~' >> .gitignore
        git add ^.*
        git commit -m 'Initial commit.'
        git remote add origin git@github.com:${ghuser}/${repo}.git
        git push -u origin master
}