Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show both staged & working tree in git diff?

Tags:

git

diff

If I run git diff I see the changes in my working tree, and if I run git diff --staged (alternatively --cached) then I see the changes that are staged (w/ git add) but is there a way with git diff to see all in one go?

like image 741
swrobel Avatar asked Oct 24 '12 20:10

swrobel


People also ask

How can I tell if a file is staged?

simply typing git status gives you a list of staged files, a list of modified yet unstaged files, and a list of untracked files. @houtanb, git status shows you a diff. (It doesn't show you all staged files).

How do I see changes not staged for commit?

If you just want to see the diff without committing, use git diff to see unstaged changes, git diff --cached to see changes staged for commit, or git diff HEAD to see both staged and unstaged changes in your working tree.

Which command will show the differences between the staged and committed versions of the file?

The git diff command shows the differences between the files in two commits or between your current repository and a previous commit.


1 Answers

If you mean the changes between the working tree and your HEAD commit (i.e. both staged and unstaged changes together) this is just done with:

git diff HEAD 
like image 83
CB Bailey Avatar answered Oct 14 '22 03:10

CB Bailey