当前回答
Git 获取
帮助您从一个git repository
。让我们假设你在一个团队中工作 使用GitFlow
,其中团队在多个branches
(特征). 与git fetch --all
command
您可以了解所有新的信息branches
内repository
.
大部分git fetch
用于git reset
。例如,您想要将全部本地更改恢复到当前仓库状态。
git fetch --all // get known about latest updates
git reset --hard origin/[branch] // revert to current branch state
Git 拉着
此命令更新您branch
与当前repository
branch
状态。让我们继续GitFlow
多个特性branches
原为merged
至develop
分支,当您想要为项目开发新特性时,您必须去开发branch
并做一个git pull
以获得当前状态develop
branch
GitFlow 文档文档https://gist.github.com/peterdeweese/4251497
其他回答
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" ,因为有人一直在标记 一些文章在这里。
我想用视觉来描述这些事情。也许其他开发商也想看,所以我还要补充一下。我不完全确定这一切是否都正确,所以如果你发现任何错误,请评论。
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 Fitch 来更新 ) 。
Git 获取
帮助您从一个git repository
。让我们假设你在一个团队中工作 使用GitFlow
,其中团队在多个branches
(特征). 与git fetch --all
command
您可以了解所有新的信息branches
内repository
.
大部分git fetch
用于git reset
。例如,您想要将全部本地更改恢复到当前仓库状态。
git fetch --all // get known about latest updates
git reset --hard origin/[branch] // revert to current branch state
Git 拉着
此命令更新您branch
与当前repository
branch
状态。让我们继续GitFlow
多个特性branches
原为merged
至develop
分支,当您想要为项目开发新特性时,您必须去开发branch
并做一个git pull
以获得当前状态develop
branch
GitFlow 文档文档https://gist.github.com/peterdeweese/4251497
git pull = git fetch + git merge
人们必须牢记 git 的性质。 您有远程和本地分支( 不一定相同 ) 。 与其他源控制系统相比, 这可能会有点令人困惑 。
通常当您检出远程时,会创建本地副本,跟踪远程。
gitreach 将会与远程分支合作并更新您的信息 。
实际上,如果其他SWES同一个部门工作,就属于这种情况,而小型项目----一个部门----一个项目设想方案的情况很少。
您对本地分支的工作仍然完好无损 。 为了将更改带回您的本地分支, 您必须合并/ 重订远程分支的更改 。
git拉动正好就是这两个步骤(即 -- -- rebase to rebase rebase 而不是合并)
如果您的本地历史和远程历史有冲突, 您将被迫在一小块按键发布您的更改时进行合并 。
因此,这真正取决于你的工作环境的性质和使用经验。
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的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之间的区别