Git Snippets: hard reset + soft reset + merge 清理复杂历史

如果没有 AI 帮我清理 commit,感觉就会越拉越大(

Git Snippets: 本地合并上游分支

首先先将上游仓库添加到 git remote 中 1git remote add upstream [repo_url] 接着 fetch 上游仓库的代码和分支 1git fetch upstream 假设我想将本地分支 A 和原仓库分支 B 进行合...

Git Snippets: 先 clone 后下载 submodule

有时不清楚项目是否有 submodule 的情况下,可以选择先 clone 下来,再 clone submodules

Git Snippets: 将原仓库下的新分支同步到自己 fork 的仓库中

其实算是 git 里非常常见的操作了

Git Snippets: 从旧 commit 分叉出新 branch

假设我们希望从 branch A 的某个旧 commit 上分叉出 branch B.首先查看 branch A 的所有 commit,找到想分叉出来的那个 commit 1git log 然后直接从 commit 分叉 branch 1git br...