diff --git a/pages.zh/common/git-clone.md b/pages.zh/common/git-clone.md new file mode 100644 index 000000000..d9dafe223 --- /dev/null +++ b/pages.zh/common/git-clone.md @@ -0,0 +1,36 @@ +# git clone + +> 克隆现有的代码库。 +> 更多信息:. + +- 克隆一个现有的代码库: + +`git clone {{远程代码库地址}}` + +- 克隆一个现有的代码库到指定文件夹: + +`git clone {{远程代码库地址}} {{路径/到/文件夹}}` + +- 克隆一个现有的代码库和它的子模块: + +`git clone --recursive {{远程代码库地址}}` + +- 克隆一个本地的代码库: + +`git clone -l {{路径/到/本地/代码库名}}` + +- 静默克隆,不打印任何日志: + +`git clone -q {{远程代码库地址}}` + +- 克隆一个现有的代码库,只获取默认分支上10个最新的提交(对节省时间很有用): + +`git clone --depth {{10}} {{远程代码库地址}}` + +- 克隆一个现有的、特定远程分支的代码库: + +`git clone --branch {{分支名称}} --single-branch {{远程代码库地址}}` + +- 使用 SSH 命令克隆一个现有的代码库: + +`git clone --config core.sshCommand="{{ssh -i 路径/到/ssh_私钥}}" {{远程代码库地址}}` diff --git a/pages.zh/common/git-pull.md b/pages.zh/common/git-pull.md new file mode 100644 index 000000000..78bfd5c6b --- /dev/null +++ b/pages.zh/common/git-pull.md @@ -0,0 +1,16 @@ +# git pull + +> 从远程代码库拉取分支,并将其合并到本地代码库。 +> 更多信息:. + +- 从默认的远程分支中拉取代码并执行合并: + +`git pull` + +- 使用快进功能(快进到含义为:先清空暂存区,再执行合并,最后恢复暂存区),从默认的远程分支拉取代码并执行合并: + +`git pull --rebase` + +- 从给定的分支中拉取代码,并执行合并到对应分支: + +`git pull {{远程分支名}} {{本地分支名}}`