Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git diff all local uncommitted changes

Tags:

git

git-diff

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?

like image 720
dabljues Avatar asked Jun 13 '26 15:06

dabljues


1 Answers

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).

like image 80
DaveyDaveDave Avatar answered Jun 16 '26 06:06

DaveyDaveDave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!