Is there a way to list all additions (ever) to a Git project?

Sometimes at the end of a project I think to myself, "Wow, I just wrote a ton of lines of code for this project." But I never know how much.

Is there a way to actually list all the added lines of code in the repo since it was created?

I think it would be interesting to see.

EDIT: I also think it would be great if there was some way to save all the lines of code I wrote into one monstrous txt file - just for the sake of looking at it. Is it possible?

+3


source to share


1 answer


"all added lines of code for the repo" is basically all the code currently in the repo.

Now, if you want to know how much code you have added to the repo, you can get a summary by doing for example

git log --author 'Yourself' --patch | diffstat

      

To see all the lines you added (i.e. all the ones that appear with a presenter +

in one of the patches), you can run



git log --author 'Yourself' --patch | grep -v '^\+\+\+ ' | grep '^\+' | sed 's/^\+//' >my-added-lines.txt

      

and read it my-added-lines.txt

.

For more details (graph of who added that at what point in time ...) have a look at gitstats .

edit : added a way to view all added lines.

+2


source







All Articles