[英]Why shouldn't you commit on a tag

I'm looking for arguments to convince an customer that he should never commit changes to a tag once it is created.


Common sense appears to be no valid argument so I need something more substantial.


6 个解决方案



Tags exist as copies of the sourcecode at a fixed point in time - regardless of whatever changes you might make to the Trunk or any Branch folders, you'll always be able to go back to the code as it was when the tag copy was created.


If you're committing to tagged copies, they no longer represent the source at the point the copy was created - so there's little point having them. Your client should be committing to the trunk, or to branches.




Users who are using the project may be using a certain tagged version of your code. They know their code works with the tag you've specified and will happily release based on this assumption. If you change the tag, then the user's code may break. A tag is literally that - it is a stable milestone on which other user's can consider set in stone.


Also, if there is more than one developer on the project, they'll be working on trunk. When they update, they won't get the changes that were made on the tag which will cause a huge merge problem.




Tag should point to some existing revision in time. You're basically giving this revision a name, i.e. tag. In SVN, tag is just a copy in /tags directory, so commiting is possible, but that's just an implementation detail. Nothing prevents you from commiting, but it's unusual, and people using the tag may be confused what exactly this tag represent ... original revision when tag was created or new changes. In the end, it's all about communicating your intent.


In other systems, tags are just pointers to specific revision. You can create new branch from tagged revision, but tag remains pointing to original revision.




When tagging a version, it can be hard to predict if you will later need to go back to that version and make changes. Sometimes you wish you had made a branch instead of just a tag, but most of times a branch is overkill.


Maybe you can convince your customer to take another approach, between committing on a tag and make a branch (which a lot of people fear).


First make a local copy of a tag, then make the necessary changes (locally), and commit the result as a new tag. If the new version requires several commits, you can give the new tag a draft name—just to make sure no one mistakes this tag for a finished version—and when all commits are made, rename the new tag to a final name. (I believe SVN allows renaming tags, although I've never done it.)




Old post, but as other might still read it I'll add my two cents:


Previous answers all rely on the common sense you say the client is not responding to. Try this story instead: "A tag is like taking a family picture at a wedding. You wouldn't pull out your permanent marker to add aunt Lisa to the picture, would you? If you want to paint, use a piece of paper instead. (=branch)"


As a side note it'd be interesting to know why the customer wants to commit to the tag. I find it much easier to argue when knowing what the counterpart is trying to achieve, and the needs behind that.




Ok.. what if you've got brilliant co-workers who make tags that are seriously bloated versions of the code, full of temp files, etc., that are absolutely unnecessary?! I think removing the junk and committing back to the tag is fine.. as long as there is a comment about it (comment will have timestamps, and I assume any change to a tag will also have a timestamp, so pretty easy to look for comments from around that time). Of course, if you're a big company, or a seriously professional, well-structured and red-taped (we're nowhere near this), then it is a different story.

好吧. .如果你有出色的同事,他們制作的標簽是非常臃腫的代碼版本,充斥着臨時文件,等等,那是絕對沒有必要的?我認為清除垃圾並返回標簽是可以的。只要有關於它的注釋(注釋將有時間戳,並且我認為對標記的任何更改也會有一個時間戳,所以很容易在那個時候查看注釋)。當然,如果你是一家大公司,或者是一個專業的、結構良好的、紅的(我們離這很近),那就另當別論了。



粤ICP备14056181号  © 2014-2020 ITdaan.com