Git pull 和 Git fick 之间有什么区别?


当前回答

此图形可能有用 。 git pull 基本上等于 Git 获取然后 git 合并

其他回答

所有分支都储存在.git/refs中。

所有地方分支机构都储存在.git/refs/heads中。

所有远程分支都储存在.git/refs/remotes中。

git 获取命令下载承诺、 文件、 从远程仓库获取 refs 到您的本地 repo 。 获取是您想要看到其他人的工作内容时要做的事情 。

所以当您在 Git 获取所有文件、 承诺和 ref 时, 在

此目录. git/ refs/ remotes

您可以切换到这些分支以查看变化 。

另外,如果你愿意,你可以把它们合并起来。

git pull 只是下载这些修改, 并合并到当前分支 。

示例示例示例示例

如果您想要看到远程分支 Dev/jd/feature/auth 的工作, 您只需要做

git 获取源于 dev/jd/ feature/auth

看到变化或工作进展做,

git 检出 dev/jd/feature/auth

但如果您也想要获取它们并将其合并到当前分支,

git 拉力源dev/jd/feature/auth

如果您选择了 Git 获取源代码分支_ name, 它将会获取分支, 现在您可以切换到您想要的分支, 并查看这些变化。 您的本地主子或其他本地分支不会受到影响 。 但 Git pull 源代码分支_ name 将会获取分支, 并同时合并到当前分支 。

用最简单的术语来说, git pull 是一个 Git 抓取, 然后是 git 合并 。


git 在 refs/ remotes/ <remote> / 下获取远程跟踪分支的更新。 此操作随时可以安全运行, 因为它不会在 refs/ head 下更改您的本地分支 。

git 拉动使当地的一个分支能够更新其远程版本,同时更新其他远程跟踪分支。

Git Pull 的 Git 文档 :

git pull 运行 git 获取带有给定参数的 Git 抓取, 然后根据配置选项或命令行旗帜, 将调用 git 重新基准或 Git 合并以调和不同的分支 。

此图形可能有用 。 git pull 基本上等于 Git 获取然后 git 合并

git 将代码从远程服务器拖动到您本地仓库的跟踪分支。 如果您的远程代码被命名为源代码( 默认) , 这些分支将位于源代码/ 内, 例如源代码/ 源代码/ 主管、 源代码/ mybranch-123 等 。 这些不是您当前的分支, 它们是服务器上这些分支的本地副本 。

git pull 进行 git 抓取, 但也同时将代码从跟踪分支合并到您当前本地版本的分支中。 如果您还没有准备好修改, 请先拨入 。

git-pull - Fetch from and merge with another repository or a local branch
SYNOPSIS

git pull   …
DESCRIPTION

Runs git-fetch with the given parameters, and calls git-merge to merge the 
retrieved head(s) into the current branch. With --rebase, calls git-rebase 
instead of git-merge.

Note that you can use . (current directory) as the <repository> to pull 
from the local repository — this is useful when merging local branches 
into the current branch.

Also note that options meant for git-pull itself and underlying git-merge 
must be given before the options meant for git-fetch.

如果你想要合并历史,你会拉拉, 你会拉拉,你会拉拉拉,如果你只是"想要的cotz" ,因为有人一直在标记 一些文章在这里。