git标签与git分支有什么不同? [英] How are git tags different from git branches?

查看:188
本文介绍了git标签与git分支有什么不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解何时应该使用标签与分支来管理我的代码库。 标签代表标签代表在某个时刻某个特定分支的版本。分支代表一个独立的开发线程,可以与同一代码库上的其他开发工作同时运行。对分支的更改最终可能会合并到另一个分支中以统一它们。通常,您会标记特定版本,以便重新创建它,例如,这是我们运送给XYZ Corp.的版本分支更多的是提供正在进行的特定版本代码更新的策略,同时继续对其进行开发。您将制作交付版本的分支,继续在主线上进行开发,但对代表交付版本的分支进行错误修复。最终,您会将这些错误修复合并回主线。通常你会同时使用分支和标记。您将拥有各种标签,这些标签既可以应用于主线,也可以应用于每个分支的标记特定版本(例如交付给客户的版本)的分支 - 您可能需要重新创建这些分支 - 用于交付,错误诊断等。 p>

它实际上比这更复杂 - 或者像你想要的那样复杂 - 但这些例子应该让你知道它们之间的差异。


I'm trying to understand when I should use tags vs branches to manage my code base.

解决方案

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.

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标签与git分支有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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