1

我有 3 个地方 A、B 和 C,我想在其中签出/克隆不同的、可能相交的 repo R 子集。我希望任何用于“标记”这些子集的方法都是 repo 的永久部分(而不是而不是我维护的外部列表)。

这是可能的,如果可以,我该怎么做?

4

1 回答 1

1

First of all, when you clone a repo, you will get all content of it, you can't pull only a part of it.

In git, you can use branches to give a name to a commit. So you might start a new branch, compose it the way you want. Afterwards, you push that to the remote repository. Same with B and C.

When you first clone the repo, just select the respective branch you want to use. When you add commits to a branch, the HEAD of the branch will move with the commits, so you will always have the latest version once pushed.

If you look for a single, permanent mark, you can compose your branch, and use a tag. A tag is always associated with a single commit and won't move unless explicitly done by the user.

于 2012-11-21T23:18:05.760 回答