threads / discuss / 22040

immutable tags?

Subject: immutable tags?

## tl;dr

8 messages between Dec 28, 2009 and Dec 28, 2009.

replies: 7people: 5as markdown or json

Carlos Santana· Dec 28, 2009, 20:04 UTC · lore

I would like to know if there is any difference between branches and tags. Is it only conceptual - convention to be followed by a developer or some technical difference? e.g. : Is it possible to create immutable tags so that nothing can be checked in to that 'tagged directory'?

- CS.

david@lang.hm· Dec 28, 2009, 20:25 UTC · re: Carlos Santana · lore

Re: immutable tags?

On Mon, 28 Dec 2009, Carlos Santana wrote:
Show 5 quoted lines
> I would like to know if there is any difference between branches and
> tags. Is it only conceptual - convention to be followed by a developer
> or some technical difference?  e.g. : Is it possible to create
> immutable tags so that nothing can be checked in to that 'tagged
> directory'?
tags are pointers into the tree. tags do not change.

in git directories are not tagged, so I'm not sure what you are working towards here.

David Lang
Carlos Santana· Dec 28, 2009, 20:39 UTC · re: david@lang.hm · lore

Re: immutable tags?

Thanks for the reply David. I think 'tagged directory' wasn't the appropriate phrase here.

In Subversion like systems branches and tags are same, i.e., both are created using 'svn copy'. Branches are generally created for separate line of development and tags for releasing software. So developers follow convention of not checking in anything into tags. Otherwise they are same.

I know that creating branches/tags doesn't involve copying files into new directory in case of git. It will act as a pointer and make note of changes thereafter. What I am not sure is difference between branches and tags. Is it left to developer to follow subversion like convention or git provides some mechanism to 'lock' tags?

- CS.

On Mon, Dec 28, 2009 at 2:25 PM,  <david@lang.hm> wrote:
Show 16 quoted lines
> On Mon, 28 Dec 2009, Carlos Santana wrote:
>
>> I would like to know if there is any difference between branches and
>> tags. Is it only conceptual - convention to be followed by a developer
>> or some technical difference?  e.g. : Is it possible to create
>> immutable tags so that nothing can be checked in to that 'tagged
>> directory'?
>
> tags are pointers into the tree. tags do not change.
>
> in git directories are not tagged, so I'm not sure what you are working
> towards here.
>
> David Lang
>
>
david@lang.hm· Dec 28, 2009, 21:15 UTC · re: Carlos Santana · lore

Re: immutable tags?

On Mon, 28 Dec 2009, Carlos Santana wrote:
Show 14 quoted lines
> Thanks for the reply David.
> I think 'tagged directory' wasn't the appropriate phrase here.
>
> In Subversion like systems branches and tags are same, i.e., both are
> created using 'svn copy'. Branches are generally created for separate
> line of development and tags for releasing software. So developers
> follow convention of not checking in anything into tags. Otherwise
> they are same.
>
> I know that creating branches/tags doesn't involve copying files into
> new directory in case of git. It will act as a pointer and make note
> of changes thereafter. What I am not sure is difference between
> branches and tags. Is it left to developer to follow subversion like
> convention or git provides some mechanism to 'lock' tags?

git works very differently than subversion. All of git history is a branching tree of commits, all that a tag is is a pointer to a particular commit somewhere in this tree. it does not have the be the most recent commit on the branch.

all branches are (pretty much) equal, you can commit and do development on any branch.

as you say above, branches are seperate lines of development and tags can point at releases, but when you have a branch that you are doing development on, you don't have to stop doing development there when you do a release, anyone who checks out the tag will get the same thing no matter what additional development you do on that branch in the future.

does this help?
David Lang
Show 27 quoted lines
> -
> CS.
>
>
>
> On Mon, Dec 28, 2009 at 2:25 PM,  <david@lang.hm> wrote:
>> On Mon, 28 Dec 2009, Carlos Santana wrote:
>>
>>> I would like to know if there is any difference between branches and
>>> tags. Is it only conceptual - convention to be followed by a developer
>>> or some technical difference?  e.g. : Is it possible to create
>>> immutable tags so that nothing can be checked in to that 'tagged
>>> directory'?
>>
>> tags are pointers into the tree. tags do not change.
>>
>> in git directories are not tagged, so I'm not sure what you are working
>> towards here.
>>
>> David Lang
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Matthieu Moy· Dec 28, 2009, 20:58 UTC · re: Carlos Santana · lore

Re: immutable tags?

Carlos Santana <neubyr@gmail.com> writes:
Show 5 quoted lines
> I would like to know if there is any difference between branches and
> tags. Is it only conceptual - convention to be followed by a developer
> or some technical difference?  e.g. : Is it possible to create
> immutable tags so that nothing can be checked in to that 'tagged
> directory'?

A tag is just a named reference to a particular commit (or other object indeed). Once you set a tag, it doesn't move (unless you override it explicitely).

You can't prevent people from commiting something. It won't move the tag, but it will create a new commit whose parent is the tagged commit.

A branch is also a named reference to a commit, but the difference is that when you commit, the current branch is updated (i.e. the reference points to the new commit).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
David Kågedal· Dec 28, 2009, 21:21 UTC · re: Carlos Santana · lore

Re: immutable tags?

Carlos Santana <neubyr@gmail.com> writes:
Show 5 quoted lines
> I would like to know if there is any difference between branches and
> tags. Is it only conceptual - convention to be followed by a developer
> or some technical difference?  e.g. : Is it possible to create
> immutable tags so that nothing can be checked in to that 'tagged
> directory'?

You are always in full control of your own repository, and have no control over what other people do with their's. So you can't prevent other people from changing the tags in their private repos, but you can prevent them from propagating these changes back to you, or to a central repository you control.

But perhaps there is nothing to worry about. I think the git commands won't modify a tag unless you force it.

Also, if you use signed tags, you can be sure that they are not silently replaced while still claiming to be tagged by you.

-- 
David Kågedal
Carlos Santana· Dec 28, 2009, 22:22 UTC · re: David Kågedal · lore

Re: immutable tags?

Got it now. Thank you all for explanation...

- CS.

On Mon, Dec 28, 2009 at 3:21 PM, David Kågedal <davidk@lysator.liu.se> wrote:
Show 26 quoted lines
> The following message is a courtesy copy of an article
> that has been posted to gmane.comp.version-control.git as well.
>
> Carlos Santana <neubyr@gmail.com> writes:
>
>> I would like to know if there is any difference between branches and
>> tags. Is it only conceptual - convention to be followed by a developer
>> or some technical difference?  e.g. : Is it possible to create
>> immutable tags so that nothing can be checked in to that 'tagged
>> directory'?
>
> You are always in full control of your own repository, and have no
> control over what other people do with their's. So you can't prevent
> other people from changing the tags in their private repos, but you can
> prevent them from propagating these changes back to you, or to a central
> repository you control.
>
> But perhaps there is nothing to worry about. I think the git commands
> won't modify a tag unless you force it.
>
> Also, if you use signed tags, you can be sure that they are not silently
> replaced while still claiming to be tagged by you.
>
> --
> David Kågedal
>
Jakub Narebski· Dec 28, 2009, 22:22 UTC · re: Carlos Santana · lore

Re: immutable tags?

Carlos Santana <neubyr@gmail.com> writes:
Show 5 quoted lines
> I would like to know if there is any difference between branches and
> tags. Is it only conceptual - convention to be followed by a developer
> or some technical difference?  e.g. : Is it possible to create
> immutable tags so that nothing can be checked in to that 'tagged
> directory'?

There is difference. You can commit only on top of local branches, in the refs/heads/* namespace (or on top of detached HEAD).

For branches:
  $ git checkout A   # switches current branch, HEAD points to A
  $ git commit       # creates new commit on branch A, A advances (changes)
  * by default fetch gets all branches
  * by default push transfers matching branches
  * default refspec is refs/heads/*:refs/remotes/origin/*
For tags:
  $ git checkout B   # detaches HEAD, HEAD points directly to B^{} commit
                     # you are on 'no branch'
  $ git commit       # advances HEAD, tag B does not change
  * by default fetch autofollows tags (gets tags that point to commits
    you have)
  * you need to push tags explicitely
  * default refspec is refs/tags/*:refs/tags/* (mirror 1:1)
-- 
Jakub Narebski
Poland
ShadeHawk on #git

← back to recent threads