GIT常用使用方法

1. 克隆代码

一般克隆

git clone https://github.com/user00000001/user00000001.github.io.git

带子模块克隆

git clone https://github.com/user00000001/user00000001.github.io.git --recursive

克隆指定分支

选项-b可放在clone后面

git clone https://github.com/user00000001/user00000001.github.io.git -b master

2. 同步代码

一般同步

cd user00000001.github.io
git pull origin master
git push origin master

3. 提交代码

git add .
git commit -m "update. "
git commit -a # 编辑器交互式 vi/nano终端操作

4. 子模块操作

**********************!!!PROTECTION POLICY!!!**********************
Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
**********************!!!PROTECTION POLICY!!!**********************
Waiting For The Next Deployment, Maybe It Will Be Displayed After That.

5. 子树操作

# git subtree add -P <prefix> <commit>
git subtree add   --prefix=<prefix> <commit>
git subtree add   --prefix=<prefix> <repository> <ref>
git subtree pull  --prefix=<prefix> <repository> <ref>
git subtree push  --prefix=<prefix> <repository> <ref>
git subtree merge --prefix=<prefix> <commit>
git subtree split --prefix=<prefix> [OPTIONS] [<commit>]
Last Updated:
Contributors: 暾暾, jiangyunbin