How to get all tags that are assigned to a file in git?

I need to indicate which version / SHA 1 of the file was associated with one or more tags. In CVS, you can get a result similar to this:

File : abc.txt
Rev: 1.0
Tags: R1_0, R1_1

Version: 1.1
Tags: R1_2

How to get tag history for a file using git?

Edit: I often use this function to indicate which version of a file is in production. I know which version (tag) of the software is in production. Based on this, I would like to know which revision of this file was tagged (as well as which previous tags were associated with this version of the file).

In my example above:
R1_1 will be in production. By requesting abc.txt, I can say that rev1.0 for abc.txt was used for both R1_0 and R1_1. (Thus, it is unlikely that the new error in R1_1 was caused by abc.txt, because it is still the same file as R1_0)

+3
source share
3 answers

I think you are trying to be too specific in literally translating concepts from one version control system to another. I would ask: "How has it changed abc.txtsince R1_1?"

git log R1_1.. -- abc.txt

Now you know two things - it has changed and how. If you want to see the changes, go to -p.

Less useful, but what did you ask about:

, (, -, ), , :

git describe `git log --pretty=format:%H -n 1 abc.txt`

, .

+4

git , . , "git diff --name-only R1_0 R1_1" ( "git diff --stat --summary R1_0 R1_1". , "git log -1 <file>".

, , , git -bisect, , . , , ( ).

+1

What are you trying to achieve? SHA1 identifies the state of the entire repo at that point in time.

0
source

All Articles