Search code examples
gitversion-controlgit-svn

How to Tag a single file in GIT


I am very new to git. I am currently trying to get familiarized with it by using it to track changes in some excel files that I am maintaining to track some continuous activity I am involved with. All the files are in a single repository. I want to tag each file separately with their versions. Is this possible? So far what I found was the capability to tag the entire repository. If what I am trying to do is wrong, do advise me on the best practice.

Thanks in advance.

Edit

When I was doing this I deliberately deleted a previous tag to make the entire repository be tagged( as I did not find a way to tag single files) as v1.0. As I now want to reset the name of the tag with the file name and quite comfortable with the way things should happen, how can I rollback the deletion and rename the previous tag (the deleted tag)?


Solution

  • Tags are placed on specific commits as opposed to the repository as a whole as you suggest in your question.

    One way of doing what you are suggesting is making sure you only commit changes to a single file with each commit, then you can tag that commit with eg. file1-v1.0 to represent v1.0 of file1.

    What are you trying to represent by tagging these commits though? That will influence any advice on how to better your process.