Git pull 和 Git fick 之间有什么区别?
当前回答
使用 git 抓取的一个实例是, 以下会告诉您自上次拉动以来远程分支的任何变化... 这样您就可以在实际拉动之前检查, 这样就可以改变您当前分支和工作副本中的文件 。
git fetch
git diff ...origin
见 git diff 关于双点... 和三点... 语法的文件。
其他回答
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" ,因为有人一直在标记 一些文章在这里。
您可以从远程仓库获取, 查看差异, 然后拉动或合并 。
这是被称作起源的远程存储库和名为“跟踪远程分支来源/主管”的分支的分支的一个例子:
git checkout master
git fetch
git diff origin/master
git rebase origin master
git 抓取时会检索远程分支, 这样您就可以将 diff 和当前分支合并。 git 抓取时会在当前分支跟踪的远程条纹上抓取, 然后合并结果 。 您可以使用 git 抓取时查看远程分支是否有更新, 而不必将其与您的本地分支合并 。
git pull 尝试在获取承诺后自动合并 。 这是上下文敏感, 所以所有被拉过的承诺都将合并到您当前活动的分支中 。 git pull 自动合并承诺而不让您首先审查它们。 如果您不小心管理您的分支, 您可能会遇到经常的冲突 。 git 获取从目标分支中收集当前分支中不存在的任何承诺, 并将其存储在您的本地仓库中 。 但是, 它不会与当前分支合并 。 如果您需要更新您的仓库, 这特别有用 。 如果您需要更新文件, 但它正在处理一些可能中断的任务 。 要将承诺整合到当前的分支中, 您以后必须使用 Git 合并 。
简单解释:
git fetch
获取元数据。 如果您想要检查最近创建的分支, 您可能需要在退出前进行获取 。
git pull
从远程获取元元数据,并将文件从远程移动并合并到分支
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 在Bash命令提示符上添加git分支
- 如何更改Git日志日期格式
- git pull -rebase和git pull -ff-only之间的区别