1 # Setup hub function for git, if it is available; http://github.com/defunkt/hub
2 if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
3 # eval `hub alias -s zsh`
5 if ! (( $
+_has_working_hub
)); then
6 hub
--version &> /dev
/null
7 _has_working_hub
=$(($? == 0))
9 if (( $_has_working_hub )) ; then
17 # Functions #################################################################
19 # https://github.com/dbb
22 # empty_gh [NAME_OF_REPO]
24 # Use this when creating a new repo from scratch.
25 empty_gh
() { # [NAME_OF_REPO]
27 ghuser
=$( git config github.user )
34 git commit
-m 'Initial commit.'
35 git remote add origin git@github.com
:${ghuser}/${repo}.git
36 git push
-u origin master
41 # Use this when you have a directory that is not yet set up for git.
42 # This function will add all non-hidden files to git.
43 new_gh
() { # [DIRECTORY]
45 ghuser
=$( git config github.user )
48 # add all non-dot files
49 print
'.*'"\n"'*~' >> .gitignore
51 git commit
-m 'Initial commit.'
52 git remote add origin git@github.com
:${ghuser}/${repo}.git
53 git push
-u origin master
56 # exist_gh [DIRECTORY]
58 # Use this when you have a git repo that's ready to go and you want to add it
60 exist_gh
() { # [DIRECTORY]
62 name
=$( git config user.name )
63 ghuser
=$( git config github.user )
66 git remote add origin git@github.com
:${ghuser}/${repo}.git
67 git push
-u origin master
70 # End Functions #############################################################