I want to create a metric that shows me "changed lines of code" per "Bug" between two Versions (in my case branches in git).
Because our application has a lot of .swf files, I don't need to count those swf's files and I just want to count the java, xml and so on.
Is there some kind of tool who does that? or a git command like git diff --stat
for a specific file type?
Using git-diff you can compare two branches by viewing a diff between them, or you can use git-log to view a list of commits that comprise the difference between them. Compare two branches with git diff branch1.. branch2 . Check the Full Official Documentation for git-diff and git-log for more options.
The second command that you can use to compare branch differences is “log.” git log will show you all of the commit differences between the branches you specify, and, aside from the term diff being replaced with log, the syntax is exactly the same as the previous command.
You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.
To compare your currently checked out branch with other branches using Visual Studio, you can utilize the branch picker hosted in the status bar and the Git changes tool window to choose any local or remote branch to compare with. Right click the branch you are targeting and select Compare with Current Branch.
Does
git diff --stat branch1..branch2 -- '*.java' '*.xml'
do the job for you?
For me it does, but with *.c
and *.h
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With