i want to see the number of removed/added line, grouped by author for a given branch in git history. there is git shortlog -s
which shows me the number of commits per author. is there anything similar to get an overall diffstat?
相关问题
- I want to trace logs using a Macro multi parameter
- Error message 'No handlers could be found for
- convert logback.xml to log4j.properties
- Why does recursive submodule update from github fa
- Django management command doesn't show logging
相关文章
- 请教Git如何克隆本地库?
- how do I log requests and responses for debugging
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
From How to count total lines changed by a specific author in a Git repository?
The output of the following command should be reasonably easy to send to script to add up the totals:
This gives stats for all commits on the current HEAD. If you want to add up stats in other branches you will have to supply them as arguments to git log.
Since the SO question "How to count total lines changed by a specific author in a Git repository?" is not completely satisfactory, commandlinefu has alternatives (albeit not per branch):
It includes binary files, which is not good, so you could (to remove really random binary files):
(Note: as commented by trcarden, a
-x
or--exclude
option wouldn't work.From
git ls-files
man page,git ls-files -x "*pdf" ...
would only excluded untracked content, if--others
or--ignored
were added to thegit ls-files
command.)Or:
to only include specific file types.
Still, a "
git log
"-based solution should be better, like:but again, this is for one path (here 2 commits), not for all branches per branches.
This script here will do it. Put it into authorship.sh, chmod +x it, and you're all set.
On my repos I've gotten a lot of trash output from the one-liners floating around, so here is a Python script to do it right:
Note that the arguments to the script will be passed to
git ls-files
, so if you only want to show Python files:blame_stats.py '**/*.py'
If you only want to show files in one subdirectory:
blame_stats.py some_dir
And so on.
one line code(support time range selection):
explain:
output:
It's an old post but if someone is still looking for it:
install git extras
then
https://github.com/tj/git-extras