Git pull 和 Git fick 之间有什么区别?
当前回答
您可以从远程仓库获取, 查看差异, 然后拉动或合并 。
这是被称作起源的远程存储库和名为“跟踪远程分支来源/主管”的分支的分支的一个例子:
git checkout master
git fetch
git diff origin/master
git rebase origin master
其他回答
您可以从远程仓库获取, 查看差异, 然后拉动或合并 。
这是被称作起源的远程存储库和名为“跟踪远程分支来源/主管”的分支的分支的一个例子:
git checkout master
git fetch
git diff origin/master
git rebase origin master
git pull 命令其实是 Git 抓取的快捷键, 后面是 git 合并或 git 重设命令, 取决于您的配置 。 您可以配置您的 Git 仓库, 这样 git pull 是一个抓取, 后面是重置 。
我们简单地说:
git pull == git fetch + git merge
如果您运行 Git 调用, 您不需要将数据合并到本地 。 如果您运行 Git 抓取, 这意味着您必须运行 Git 合并才能将最新代码获取到本地机器 。 否则, 本地的机器代码不会在不合并的情况下被更改 。
所以在 Git Gui 中, 当您获取时, 您必须合并数据 。 获取本身不会在本地修改代码 。 您可以检查当您通过一次获取并查看来更新代码时, 是否更新了代码; 代码不会改变 。 然后您将合并... 您将会看到修改后的代码 。
使用 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添加?
- 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之间的区别