From f3b532b4d9645eab019324156d33124b755f1871 Mon Sep 17 00:00:00 2001 From: k23223 <57606136+k23223@users.noreply.github.com> Date: Tue, 5 Sep 2023 14:39:12 +0800 Subject: [PATCH] doc: update docs/git.md (#425) --- docs/git.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/git.md b/docs/git.md index 4b2b274734c..8d77231e62f 100644 --- a/docs/git.md +++ b/docs/git.md @@ -1100,6 +1100,27 @@ Host github.com ``` +### Fork仓库同步上游仓库 + +- 设置上游仓库 + + ```shell + $ git remote add upstream https://github.com/jaywcjlove/reference.git + ``` + +- 本地项目操作 + + ```shell + $ git fetch upstream # 获取上游仓库更新 + $ git stach # 暂存本地修改(如果有) + $ git branch -a # 列出所有远程仓库地址(非必须) + $ git rebase remotes/upstream/main # 使用远程仓库的提交记录来重写本地提交记录 + $ git push -f # 强制推送到远程(github)仓库 + $ git stach pop # 恢复暂存的本地修改(如果有) + ``` + + + 统计查询 ---