From 0f22978db410b0aaaf47d82ff2095e199b1f291d Mon Sep 17 00:00:00 2001 From: bgbgPang <1553427003@qq.com> Date: Mon, 4 Dec 2023 11:22:45 +0800 Subject: [PATCH] doc: update git.md (#472) Co-authored-by: zlfyuan <741136856@qq.com> --- docs/git.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/git.md b/docs/git.md index 8d77231..a17ff72 100644 --- a/docs/git.md +++ b/docs/git.md @@ -563,6 +563,34 @@ $ git fetch --all && git reset --hard origin/master $ git log Branch1 ^Branch2 ``` +### git 迁移 + +- 从原地址克隆一份裸版本库 + +```bash +$ git clone --bare https://github.com/username/project.git +``` + +- 然后新建一个地址,比如一下 + +```bash +$ https://gitee.com/username/newproject.git +``` + +- 进入project.git这个全裸版本库,以镜像推送的方式上传代码到newproject上。 + +``` +$ cd project.git + +$ git push --mirror https://gitee.com/username/newproject.git +``` + +- 使用新地址,直接 Clone 到本地就可以了。 + +``` +$ git clone https://gitee.com/username/newproject.git +``` + Git Submodule 子模块 ------