Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从最受关注的博客之一中,当您执行 git fetch 时,Git 会从目标分支收集当前分支中不存在的所有提交,并将它们存储在本地存储库中。但是,它不会将它们与您当前的分支合并。
获取所有提交后,git 将所有这些提交存储在哪里(因为它没有将它们与我的本地分支合并)以及当我执行 git fetch 时 git repo 历史记录如何变化?
它以与存储任何其他提交完全相同的方式存储它们。
Git 提交不存储在分支中;相反,分支只是指向特定提交的指针。
通常明确指定分支很方便。例如,
git fetch /path/to/repo master:sometopic
将从 /path/to/repo 的存储库中获取主分支,并将存储作为本地存储库中的某个主题的分支。
您的本地 master 分支根本不受 fetch 的影响。