Thread (16 messages) flat view 16 messages, 4 authors, 2016-06-15

Re: any way to apply tag across all branches in repository?

From: Tomas Carnecky <hidden>
Date: 2016-06-15 22:46:48

On May 19, 2009, at 6:26 PM, Chris Friesen wrote:
Hi all,

I'm hoping you can help me out...please CC me on replies, I'm not
subscribed to the list.

We have a piece of software with a "main" branch and multiple
architecture-specific "target" branches.  At each "official" compile,
we'd like to tag the commits that went into that compile with an  
identifier.

Using tags normally requires that the tag be assigned to each branch
individually--is there any way to apply some sort of designator to the
head of each branch in the repository all at once rather than doing it
separately for each branch?
Tags are not specific to any branch in particular. Usually you tag  
commits, and git doesn't care on which branch these commits are. That  
information is not recorded in the tag.

What you can do is create an alias that iterates over all branches and  
tags each one.

git for-each-ref refs/heads/main refs/heads/arch/ | while read sha  
type ref; do
     git tag TAGNAME $sha -m "Tagged $ref"
done

$sha is the sha where the ref points to, $type will be 'commit' and  
$ref is the full ref (refs/heads/arch/xxx for example)

tom
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help