https://github.com/521xueweihan/git-tips
https://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged
git diff --cached
--cached
means show the changes in the cache/index (i.e. staged changes) against the current HEAD
. --staged
is a synonym for --cached
.--staged
and --cached
does not point to HEAD
, just difference with respect to HEAD
. If you cherry pick what to commit using git add --patch
(or git add -p
), --staged
will return what is staged.git diff --name-only SHA1 SHA2
https://stackoverflow.com/questions/12593113/view-git-changes-diffs-of-local-commits-not-pushed-to-remote/12593290
You could probably use git diff like this:
git diff origin/master..HEAD
assuming that your HEAD is currently pointing to your latest commit. Otherwise, you could just use
git diff origin/master..master
(Of course, change accordingly if your remote isn't origin, or if your branch isn't master.)