Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branching from a Tag

I'm seeking opinions here. The following may be considered either an SVN-specific question, or a more general version control question.

If the sources of a project are to be branched at a point corresponding to a release, perhaps for maintenance work, is it preferable to:

(a) branch from the tag, or

(b) branch from the node (e.g. on the trunk) that the tag copies?

What are the pros and cons of these two approaches? Does it matter at all?

Thanks.

like image 560
Rhubbarb Avatar asked May 25 '10 15:05

Rhubbarb


People also ask

Can you branch from a tag?

The best way to work with git tags is to create a new branch from the existing tag. It can be done using git checkout command.

How do I create a branch from a label?

Go to View, Branches, right click and choose New Branch. * Enter a name for the branch specification. If the release 2a needs to be branched from label r0.


2 Answers

I'd suggest (b) since that will allow you to easily handing merging back to trunk using svn's merge tracking (assuming you have svn 1.5+ on the server and client side). If you used technique (a), you'd have to manage the merges yourself - which isn't bad assuming you don't do multiple merges from the same branch. Given that you are considering creating a branch from a tag, which usual for patching,, you'll probably end up needing to merge more than once to your trunk line to get those patches back in trunk.

Tags are a preferred way to take "snapshots" in time or to mark milestones of a particular code line (be it trunk or a branch) just for the purposes of quickly building a specific milestone from source that's been tagged as a milestone or for easily diff'ing between milestones. Other than that, all work is done between trunk and branches. As was already noted, you can easily find the revision/source a tag was copied from easily using svn log. For instance svn log --stop-on-copy -v tags/yourtag will put the latest copied revision at the tail of output. This allows you to create a branch from the revision an active code line from which the tag was created.

like image 76
whaley Avatar answered Sep 21 '22 18:09

whaley


In my opinion, I would go the (a) route if I intend to add and patch the main project at a later date and go (b) If I intend to develop something parallel.

like image 40
Dark Star1 Avatar answered Sep 22 '22 18:09

Dark Star1