如何在GIT中拉出另一个存储库并更新到它的头部?

时间:2012-10-31 16:57:39

标签: git

以下是Mercurial对问题的描述:

假设:

  • 两个回购 A B ,其中 B A 的分支
  • 当前目录是 A
  • 提示的工作目录

需要:

  • 拉入 B 并更新至最近的头 REV

这就是我想用Mercurial做的事情:

A> hg pull B
A> hg heads         # Notice the most recent head of B
A> hg update **REV**

我如何在GIT中完成? 更具体地说:

我知道这应该是微不足道的,我仍然无法理解。

任何?

2 个答案:

答案 0 :(得分:2)

git remote add other_repo
git fetch
git merge other_repo/branch

答案 1 :(得分:2)

git remote add a_repo a_repo_url
git fetch a_repo
git merge a_repo/branch