Reputation: 125
I am just an occasional git user, and now I have a problem that is beyond my knowledge:
Let's say there is a git repository, no branches, just tags. For given two tags. I need to get the list of all files in the reposotory, each followed by two numbers: number of lines added to the particular file between two tags, and number of lines deleted from the same file between the two tags.
I searched online, but I found only solutions for similar problem that deals with contributor, not files.
Upvotes: 1
Views: 960
Reputation: 29590
You can use git diff
with the --numstat
option to show "number of added and deleted lines in decimal notation" for each modified file between the two tags.
git diff tag1 tag2 --numstat
From the git docs:
The
--numstat
option gives the diffstat(1) information but is designed for easier machine consumption. An entry in--numstat
output looks like this:
1 2 README
3 1 arch/{i386 => x86}/Makefile
That is, from left to right:
- the number of added lines;
- a tab;
- the number of deleted lines;
- a tab;
- pathname (possibly with rename/copy information);
- a newline.
Upvotes: 4
Reputation: 241848
Just run
git diff --stat tag1 tag2
The files not listed have 0 changes, binary files show -
as the number of changes.
Upvotes: 3