-2

My application needs to conform to a new specification.

So I want to tag a version of my app as it stands. I want to be able to check out this version in the future.

I committed all my latest changes.

And I do:

git tag -a stable-pre-new-spec

When I execute:

git show stable-pre-new-spec

it displays the diffs from my last commit ?! I don't exactly understand what is going on.

Should I be creating a branch instead ?

Jacques René Mesrine
  • 46,127
  • 27
  • 66
  • 104
  • I don't see the problem here. 'stable-pre-new-spec' is symbolic name for given commit. "git show " will show contents of tag (if it is annotated tag), and below it would show "git show ^{commit}" which includes changeset of commit you tagged. – Jakub Narębski May 11 '09 at 09:49
  • I don't want to tag just my commits. I want the current snapshot of the source tree (i.e. every artifact) to be "tagged" with a string. – Jacques René Mesrine May 11 '09 at 10:17
  • 1
    The tag points to the source tree at the given commit. That _is_ your snapshot. You can easily use “git checkout [-b ] ” to get back to the version and further edit it. There’s no “tagging every artifact” in git because it doesn’t make sense: you always handle a complete repository, not single files. – Bombe May 11 '09 at 10:40

2 Answers2

2

Two things are going on. First, git revisions are revisions of the whole file tree. In contrast, I believe cvs and svn give separate revision numbers to the individual files. So in cvs or svn, the "tag" operation goes out and attaches, e.g., "stable-pre-new-spec" to file1 version 1.0.3, file 2 version 1.0.2, file3 version 2.0, file 4 version 1.3.7, etc. And then when you want to fetch using that tag, the system goes and finds all the pieces with that tag. In git, the one revision already is about the whole set, tagging just gives another name to it.

Second-- and this applies to many cm systems including cvs and svn-- git gives the same name to a state and the difference. Git calls this combined thing a commit. So you ask about the version and it shows you a diff between that and the immediately previous state. In git, the commit id is actually a checksum of the whole saved tree contents; it's just conventional to show you the golden spike.

In git you can tag a commit or create a branch from it any time after you created it.

FutureNerd
  • 769
  • 7
  • 9
0

I'd use a branch in your case:

git checkout -b app_in_current_state

You'll then be able to continue developing on master, while bugfixing on your current state in the branch.

Codebeef
  • 43,508
  • 23
  • 86
  • 119