Archive for software

What do “branch”, “tag” and “trunk” really mean?

Hmm, not sure I agree with Nick re tag being similar to a branch. A tag is just a marker

  • Trunk would be the main body of development, originating from the the start of the project until the present.
  • Branch will be a copy of code derived from a certain point in the trunk that is used for applying major changes to the code while preserving the integrity of the code in the trunk. If the major changes work according to plan, they are usually merged back into the trunk.
  • Tag will be a point in time on the trunk or a branch that you wish to preserve. The two main reasons for preservation would be that either this is a major release of the software, whether alpha, beta, RC or RTM, or this is the most stable point of the software before major revisions on the trunk were applied.

In open source projects, major branches that are not accepted into the trunk by the project stakeholders can become the bases for forks — e.g., totally separate projects that share a common origin with other source code.

發表迴響

Trunk / Branches / Tags 在 CVS 上的應用 (1)

辦公室導入 Subversion 也一段時間了,也越來越多人將 code 加入辦公室集中建置的 Subversion 了,但對於 Trunk / Branches / Tags 總是沒有人出來做一個說明。

其實,從好幾年前開始碰 CVS 這種東西就是用 Subversion 了,所以我對 Trunk / Branches / Tags 也沒這麼多了解,畢竟 Subversion 的精神是版本號阿,那些啥 branch / tag 表示的只是某個版本號的東西,讓我們易懂罷了,所以我也是使用 Subversion 一段時間後,慢慢累積了一些 CVS 相關的經驗後才對這三個名詞的定義有了更深一層的了解,所以只敢說是經驗分享囉!  ^^

Trunk:其實就是最新,一直在走的東西,永遠都是最新的,所以只有一份。

Branches:就是版本,例如 V1 , V2 , V3。也可能是某個特定需求,例如 V1-1,所以 Branch 用的就是複數啦!

Tags:就是可以進行標籤註明了,例如 V1-Release , V1-Release-p1 , V2-Release , V2-Beta1 之類的。一般來說,轉到 tags 裡面的 code 大部分都是 read-only 了,不會再對這個 Tag 內的 Code 進行 commit。也因為會有很多 Tag,所以這邊也是複數。

我底下就用實例做個解釋吧!假設我們現在有一個開發案叫做「foo」。

  1. 首先我們建立一台 Subversion,並且開始將寫好的 code 都一直丟到 trunk 中
  2. 經過了幾次開會,已經確定第一版所需要的功能 ( 在這稱為 foo-v1 ),我們就將 trunk 中的東西丟一份到 branches,並取名為 foo-v1,之後跟 foo-v1 相關的開發就都更新到 foo-v1 這個 branch ( 記得也要不斷的 merge 回 trunk 阿 )
  3. 當 foo-v1 開發到一定程度,已經可以發佈 BETA 版,我們則可以丟到 Tags,並給個版本一個 Tag 叫做「foo-v1-beta1」,相同的,如果要 Release 的時候一樣是給一個 Tag 叫做「foo-v1-release」,這樣就可以了。
  4. 如果 foo-v1-release 發現 Bug,則修改完畢後的 code 就再新增一個「foo-v1-release-p1」的 Tag 放置 Bug Fixed 的程式碼。
  5. 又過了一段時間,決定開發 foo-v2,這時候一樣在 Branches 底下開一個「foo-v2」,跟 foo-v2 相關的修改就改在這邊啦,但也不要忘記有更新要 merge 回 trunk

上述大概就是我對整個 Trunk / Branches / Tags 的想法。一定會有很多人說,如果我只是要新增加一個功能不一定是一個版本怎辦?其實就在 Branches 底下自己建立一個就好啦,例如「foo-v1-special-edition」之類的。

不過,我覺得 svn ( cvs ) 只是一個工具,要怎麼用這群人談好就好,反正不要亂掉就好,你高興在 trunk 內建立很多不同的 tag 也是可以阿!或大家都只更新 trunk,branches 給每個人放自己開發的 code 也是可以,反正最重要的就是大家講好都可以接受就好。講的很亂,有人看的懂嗎?  XD

文章出處:

http://blog.xuite.net/hookah/blog/21968245

發表迴響

Follow

Get every new post delivered to your Inbox.