当前回答
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 拉命令实际上是一个shortcut
用于git 获取 git 获取排 排 排 排 排 排 排 排 紧 排 排git 合并或git 重新基数取决于您的配置配置命令。 您可以配置您的 Git 仓库, 这样git 拉是一个接驳物,然后是一个重置物。
之间唯一的差别git pull
和git fetch
是:
git pull
从远程分支拉出并合并。
git fetch
仅从远程分支获取取取, 但它不合并
i. e. git pull = git 获取 + git 合并...
我们简单地说:
git pull == git fetch + git merge
如果你逃跑git pull
中,您不需要将数据合并到本地数据。如果运行git fetch
这意味着你必须跑git merge
获取本地机器的最新代码。 否则, 本地机器代码不会在不合并的情况下被更改 。
所以在 Git Gui 中, 当您获取时, 您必须合并数据 。 获取本身不会在本地修改代码 。 您可以检查当您通过一次获取并查看来更新代码时, 是否更新了代码; 代码不会改变 。 然后您将合并... 您将会看到修改后的代码 。
Git使用两个命令从远程到本地获取最新版本的分支 :
git 获取: Git 将会从远程获取最新版本到本地版本, 但不会自动合并 。
git fetch origin master
git log -p master..origin/master
git merge origin/master
以上命令意味着从远程到源主分支下载主分支的最新版本。 然后比较本地主分支和源主分支。 最后, 合并 。
Git将从远程获取最新版本, 并合并到本地 。
git pull origin master
以上命令相当于
git fetch
和git merge
在实践中,git fetch
也许更安全,因为在合并之前,我们可以看到变化,决定是否合并。
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的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之间的区别