I have a following problem. I want to get the output from git diff
, but for all uncommitted local changes (that means unstaged and staged files).
I am not searching for git log, or any other output, it has to be git diff
output, because then I am parsing it with the parser I made.
For now I have:
All unstaged files:
git diff
Staged + unstaged files + all local commits (compare to remote)
git diff origin/master
Now I am missing the part when I can get git diff
for all unstaged and staged files, but not compare it with remote (cuz it would take all local commits too), but just compare it with last local commit. Is there a way to do this?
Taken from this answer, to a similar (but I don't think duplicate) question, I think what you're looking for is:
git diff HEAD
This will show you all the differences between your current working directory (i.e. your staged and unstaged changes) and the HEAD commit.
Or - if you prefer to match the syntax in your question, this would do the same thing:
git diff master
(where master
is your current branch).