1

I am using tags like freeze labels.

I have made a commit comprising 10 files and applied a tag T to it and have pushed the tag and the commit to the remote repo.

I subsequently realized I need to fix 1 of those 10 files. So I modified that file and committed it. Is there a way I can push the commit and apply the same tag T to both commits, so that if someone later checks out that tag T (never mind if its in detached-HEAD state), he gets the contents of both commits (ie. 9 files from the first commit and the updated file from the new commit)?

vharihar
  • 69
  • 7

1 Answers1

1

so that if someone later checks out that tag T

Checking out a tag means getting the full repository, so they will get all files.

You can use tag -f to move your existing tag, push again.

Again, a tag is (generally) applied to a commit, which represents the full repository.
See "Tag specific files in git".

tag commit tree

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • VonC, if I make a new commit containing just the 1 fixed file, and move the tag T to this new commit as you suggest, then a subsequent checkout of tag T will contain just the 1 file, isn't it? It won't contain the other 9 files, isn't it? I want a subsequent checkout of the tag to contain the 9 earlier files as well as the 1 fixed file. – vharihar Feb 04 '21 at 09:21
  • 1
    @user199039 no, a checkout checks out *all* files of the repository: a Tag does not reference a file but a commit, which in turn represent a full repository state. – VonC Feb 04 '21 at 09:23