See the number of lines changed with git


To see the number of lines changed in the current working directory:

git diff --stat

The output will look something like this:

file.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

To see the number of lines changed in a git commit:

git diff --stat <commit>

This means you can see the number of lines changed for the most recent git commit:

git diff --stat HEAD~

To remove a dirty working directory from the diff, use git stash:

git stash

Pop the stash to restore it:

git stash pop

See git diff to learn more.



Please support this site and join our Discord!