When I run git status, I can see that certain files have been modified, but that get no more information. Is there any way to see the total number of lines changed/deleted/added in these files, even if they are unstaged/uncommitted?
This would be helpful because I sometimes make major changes to one file, then really minor changes to other files spontaneously. I would like to commit these groups separately, and with separate commit messages, for organization. And having this capability with git status would help me determine at-a-glance which files have had only very minor changes.
Is there any way to see the total number of lines changed/deleted/added in these files, even if they are unstaged/uncommitted?
Yes, git diff --stat. Though this won't show untracked files.
git diff shows the difference between the working copy and the staging area. --stat, and various other flags, format it.
This would be helpful because I sometimes make major changes to one file, then really minor changes to other files spontaneously. I would like to commit these groups separately, and with separate commit messages, for organization.
Two additional commands are handy here.
git commit -v will show you the full diff in your editor while you're writing the commit message. Useful for a quick review.
git add -p will allow you to decide which hunks to add to the staging area.
For staged files you can do this with git diff --staged --stat or git diff --cached --numstat.
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