Is there anyway to see how a file’s size has changed through time in a git repository? I want to see how my main.js file (which is the combination of several files and minified) has grown and shrunk over time.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could create a script that uses the output from
git show --pretty=raw <commit>to obtain the tree, then usesgit ls-tree -r -lto obtain the blob you are looking for, including the file size.In case you have ruby and the grit gem installed, here’s a little script I threw together:
Example usage (filename of script is file-size.rb), will show you the history for somedir/somefile: