Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many lines of code differs between two commits or two branches?

Tags:

git

I want to know how many lines of code I changed between two different commits. My purpose is to understand how many lines of code I've written today but my abstract idea is to understand how many lines of code I've write from a moment to another one. Can someone help me for this stuff?

like image 450
sensorario Avatar asked Jul 29 '13 04:07

sensorario


Video Answer


2 Answers

Like many git commands git diff --shortstat doesn't just work with commits, but also with branch names, tags, etc. So if you're on a feature/foo branch and want to compare to develop run.

git diff --shortstat develop

If you want to know how many lines changed since the last version tag (e.g. 3.1) run

git diff --shortstat 3.1

like image 39
orkoden Avatar answered Oct 06 '22 01:10

orkoden


--shortstat is what you want:

git diff --shortstat commit1 commit2 

You could also use it like:

git diff --shortstat "@{1 day ago}"  
like image 95
xdazz Avatar answered Oct 05 '22 23:10

xdazz