I would like to generate a weekly GIT report, where I can see how many code has been submitted and deleted by each developer in specific timeframe.
The purpose is to get general overview of developers activity in specific timeframe
It would be great if I can export these information into csv
[some-script/command] > weekly-git-log.csv
I'd start with git log --since="1 week ago" --until="now"
and customize it to your heart's content.
Example:
git log --since="1 week ago" --until="now" --format="%an,%ct,%s" > weekly-git-log.csv
You aren't being very specific about what you want to store in the CSV file, so I'm giving you a very general answer and letting you fill in the details yourself.
EDIT:
If you want to get lines added/removed, you're going to have to get a bit fancier and use a bash script:
#!/bin/bash
IFS=$'\n'
DATA=(`git log --since="1 week ago" --until="now" --format="%ct,%an,%s,"`)
LINES=(`git log --since="1 week ago" --until="now" --pretty=tformat: --shortstat | gawk '(NF > 0){ printf "%s,%s\n",$1,$4 }' -`)
i=0
while [ $i -lt ${#DATA[@]} ]; do
echo "${DATA[$i]}${LINES[$i]}"
i=$[i + 1]
done
I'm throwing in lines added/removed after the message, since it's easier to do in the script (I'm not THAT great with bash). This should be a pretty good foundation for what you want to do. (call ./script.sh >file.csv
to output to a file)
Note that commas in the commit message will break your csv file, I'd change the commas in the --format
to some obscure character that can't be regularly typed on a keyboard, scrub out any commas in the message, then substitute commas for that obscure character.
Or you can just do away with %s
in the format too if you don't need the message.
List of changes for specific user in specific date range - Each file details
git log --pretty=format:"%h,%an,%ad,%s" --author=example@email.com --since=2012-11-19 --until=2012-11-20 --date=short --numstat
List of changes for specific user in specific date range - Commit summary
git log --pretty=format:"%h,%an,%ad,%s" --author=example@email.com --since=2012-11-19 --until=2012-11-20 --date=short --shortstat
Final short version
git log --pretty=format:"%Cgreen%ad%x09%Cblue%s" --date=short --author=example@email.com --shortstat --since=2012-11-19 --until=2012-11-20
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