Git pull 和 Git fick 之间有什么区别?
当前回答
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-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 pull 是一个 Git 抓取, 然后是 git 合并 。
git 在 refs/ remotes/ <remote> / 下获取远程跟踪分支的更新。 此操作随时可以安全运行, 因为它不会在 refs/ head 下更改您的本地分支 。
git 拉动使当地的一个分支能够更新其远程版本,同时更新其他远程跟踪分支。
Git Pull 的 Git 文档 :
git pull 运行 git 获取带有给定参数的 Git 抓取, 然后根据配置选项或命令行旗帜, 将调用 git 重新基准或 Git 合并以调和不同的分支 。
git 抓取时会检索远程分支, 这样您就可以将 diff 和当前分支合并。 git 抓取时会在当前分支跟踪的远程条纹上抓取, 然后合并结果 。 您可以使用 git 抓取时查看远程分支是否有更新, 而不必将其与您的本地分支合并 。
您可以从远程仓库获取, 查看差异, 然后拉动或合并 。
这是被称作起源的远程存储库和名为“跟踪远程分支来源/主管”的分支的分支的一个例子:
git checkout master
git fetch
git diff origin/master
git rebase origin master
我想用视觉来描述这些事情。也许其他开发商也想看,所以我还要补充一下。我不完全确定这一切是否都正确,所以如果你发现任何错误,请评论。
LOCAL SYSTEM
. =====================================================
================= . ================= =================== =============
REMOTE REPOSITORY . REMOTE REPOSITORY LOCAL REPOSITORY WORKING COPY
(ORIGIN) . (CACHED)
for example, . mirror of the
a github repo. . remote repo
Can also be .
multiple repo's .
.
.
FETCH *------------------>*
Your local cache of the remote is updated with the origin (or multiple
external sources, that is git's distributed nature)
.
PULL *-------------------------------------------------------->*
changes are merged directly into your local copy. when conflicts occur,
you are asked for decisions.
.
COMMIT . *<---------------*
When coming from, for example, subversion, you might think that a commit
will update the origin. In git, a commit is only done to your local repo.
.
PUSH *<---------------------------------------*
Synchronizes your changes back into the origin.
拥有远程镜像的一些主要优点是:
性能(通过所有承诺和信息,而不试图通过网络挤压它) 有关您本地回购状态的反馈(例如,我使用阿特拉斯西安的源树树枝,这给了我一个灯泡,显示我是否比来源提前或落后。这个信息可以用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之间的区别