Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Kristian Woods
23,414 PointsWhen I enter git diff, I just get an empty line
When I enter git diff, I just get an empty line
4 Answers

Bethany Cooksey
14,242 PointsHave you made any changes to your file since you last used git add
or git commit
on it? Because if you haven't, there's no difference for git diff
to show.

Leah Stigale
3,349 PointsThe same thing happened to me, turned out I forgot to hit ctrl + s on the html file so I didn't save any of the changes, thus no changes were found when compared to what was previously committed.

Mark Chesney
11,698 PointsYes, I also have modified and staged my saved file, then I've modified it again (without staging it). Both show up properly in the branch master, when I type git status. However, none of these following commands show a diff in my Linux console.
git diff
git diff --staged
git log
git log -p
Does anyone know why? (all other git commands worked properly: init, add, commit -m "msg", etc.

Mark Chesney
11,698 Pointsooh, i found the answer: someone else posted on stack overflow:
It turned out that I just needed to set the PAGER environment variable to less (or more) programs to solve both problems.
export PAGER=less

Antonio De Rose
20,882 Pointsthat does emphasise, that the code in the working directory is the same to, what is in the staging area. what are you trying to do, and what are you expecting.
Bethany Cooksey
14,242 PointsBethany Cooksey
14,242 PointsIf you are trying to see changes to a file that's "staged", a.k.a. you just used
git add
on it but haven't usedgit commit
yet, you can usegit diff --staged
instead.