I am working on a real mess of a project and we've been planning to refactor it for months but nobody has the time. I want to see which files are most modified because the features/codes contained in those files will have the priority on refactoring and increasing my productivity.
Is it possible to get number of times each file was modified since first commit or a specific week, in a table format or something, in git? If so, how?
I apologize that I do not provide a "what have I tried" because frankly I rarely use git from command line and I'm really poor at it and the GUI ones are just not enough.
Short answer is no: they'll see the file creation date on their disk, i.e. the timestamp when the files where created for the first time on that disk.
Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.
DESCRIPTION. This counts the number of unpacked object files and disk space consumed by them, to help you decide when it is a good time to repack.
To count the number of commits for each of your files, you could do something like this
#!/bin/bash
for file in *.php;
do
echo $file
git log --oneline -- $file | wc -l
done
"git log" is the key git command here.
Here are some git commands and options to look at
git log
git log --oneline
To get a log of changes for a specific file
git log -- filename
To get a log of changes for a specific file during a specific date you can do
git log --after="2017-05-09T16:36:00-07:00" --before="2017-05-10T08:00:00-07:00" -- myfile
You may want to try
git log --pretty=format
you can look up all the different formats
You could get a private repository on github and push it all up there; that would be a nice graphical way to see all the changes for any of your changed files.
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