标签与Git中的分支有何不同?在这里我应该使用哪个? [英] How is a tag different from a branch in Git? Which should I use, here?

查看:379
本文介绍了标签与Git中的分支有何不同?在这里我应该使用哪个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在理解如何在tags 与 branches 时遇到一些困难=显示标记为'git'的问题 rel = tag> git

I am having some difficulty understanding how to use tags versus branches in git.

我刚刚从的问题,现在我将针对特定功能来处理该代码的子集。其他一些开发人员也将对此进行研究,但并非我们小组中的所有开发人员都将在意此功能。我应该创建分支还是标签?在什么情况下我应该使用一个而不是另一个?

I just moved the current version of our code from cvs to git, and now I'm going to be working on a subset of that code for a particular feature. A few other developers will be working on this as well, but not all developers in our group are going to care about this feature. Should I be creating a branch or a tag? In what situations should I be using one versus the other?

推荐答案

一个标签代表一个版本某个特定时刻的某个分支。 分支表示一个单独的开发线程,可以与其他开发工作在同一代码库上同时运行。对分支的更改最终可能会合并回到另一个分支以统一它们。

A tag represents a version of a particular branch at a moment in time. A branch represents a separate thread of development that may run concurrently with other development efforts on the same code base. Changes to a branch may eventually be merged back into another branch to unify them.

通常,您将标记一个特定版本,以便您可以重新创建它,例如,这是我们交付给XYZ Corp 的版本。 分支更是一种策略,可在特定版本的代码上提供持续的更新,同时继续对其进行开发。您将创建交付版本的分支,继续进行主线开发,但对代表交付版本的分支进行错误修复。最终,您将这些错误修复合并回主行。通常,您会同时使用分支和标记。您将拥有各种标签,这些标签可能会同时应用于主线及其分支,沿您想要重新创建的每个分支标记特定的版本(例如,交付给客户的版本)-用于交付,错误诊断等。

Usually you'll tag a particular version so that you can recreate it, e.g., this is the version we shipped to XYZ Corp. A branch is more of a strategy to provide on-going updates on a particular version of the code while continuing to do development on it. You'll make a branch of the delivered version, continue development on the main line, but make bug fixes to the branch that represents the delivered version. Eventually, you'll merge these bug fixes back into the main line. Often you'll use both branching and tagging together. You'll have various tags that may apply both to the main line and its branches marking particular versions (those delivered to customers, for instance) along each branch that you may want to recreate -- for delivery, bug diagnosis, etc.

实际上比这更复杂-或您想做到的复杂-但这些示例应该使您对这些区别有所了解。

It's actually more complicated than this -- or as complicated as you want to make it -- but these examples should give you an idea of the differences.

这篇关于标签与Git中的分支有何不同?在这里我应该使用哪个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆