When working on files where you want to commit specific line changes into separate commits, there is a way to individually select lines of the changes that you want to commit.


git add -p

Git diff on its own lets you view changes between your HEAD and the current unstaged state.

To view changes of staged changes (but not committed), use:

git diff --cached

In order to save time, in my personal ~/.gitconfig, I’ve added an alias:

  changes = diff --cached

[1] How can I commit only part of a file in git
[2] How do I show the changes which have been staged