基本篇
创建本地仓库
创建文件:
mkdir testcd testtouch README.md初始化git:
git init提交到本地仓库:
git add .git commit -m "commit message"
本地仓库发布到远程
新建远程仓库:
curl -u 'username' https://api.github.com/user/repos -d '{"name":"test"}'关联远程仓库(origin是git提供的仓库默认名,可自定义):
git remote add origin gitAddress/RepoNamepush到远程仓库:
git push origin master
zsh篇
探索过程:
- 在oh-my-zsh的plugins下搜索git,找到几个可疑目录
- 逐个目录一一探究、发现是
github
目录。github
下的github.plugin.zsh
如下:
我在这个文件里发现empty_gh
new_gh
exist_gh
git.io
这几个方法,方法用途查看源码和注释一目了然,不再赘述。
- 接下来在
.zshrc
中的plugins
里加入github
,如下:
:wq
之后执行 source .zshrc
基本篇的创建只需 empty_gh test
即可完成
而新建远程仓库我直接在 github.plugin.zsh
里加了一个方法: new_repo
,如下: