Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6958389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:07:59+00:00 2026-05-27T15:07:59+00:00

If I run git diff I would expect to see a list of changes

  • 0

If I run git diff I would expect to see a list of changes of my working directory relative to whatever had been committed before (or a list of the working directory contents if it’s a new repository with no commits). Try this example:

$ mkdir temp
$ cd temp
$ git init
$ echo "first line" > test.txt
$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       test.txt
nothing added to commit but untracked files present (use "git add" to track)

Let’s see a diff of test.txt:

$ git diff

This doesn’t give any output!

I would expect to see a diff like + first line, but instead I get nothing. It doesn’t tell me what’s going on. People on Stack Overflow tell me to git add some files so I do:

$ git add .
$ git diff

Still nothing!

Git GUI shows the changes.

git status -v shows the changes.

But for some reason git diff doesn’t show anything.

So my questions are:

  1. How, in plain English, does git diff work?
  2. How can I show a diff of all the changes I’ve made (unstaged and staged)?

Some people at my company are using Git, but the SVN crowd are going to point at this as a case of where Git is too confusing to be usable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:08:00+00:00Added an answer on May 27, 2026 at 3:08 pm

    Why do you get no git diff output before adding?

    Git does not treat files in the filesystem as automatically included in the version control system. You have to add things explicitly into the Git repository (as you are doing by adding the current directory with git add .).

    There is no output to git diff because Git doesn’t see any changes inside your repository, only files outside the repository, which it considers ‘untracked’ and so ignores when generating a diff.

    I found this one of the key differences to version control systems like SVN (along with staging and ignoring directories).

    If you want the untracked files to be included, git add them.

    If you don’t want them in your repository, add them to your .gitignore (see git ignore --help). This is good for C object files or Python .pyc files.

    Why don’t I get git diff output after adding?!

    So this is slightly different. If you do git status you will see the file is now in the staging area. This is the area for files that you are about to commit.

    When you git add a new file into the Git repository, it skips the working copy and goes straight into the staging area. This make sense in a way, and git add always moves files into staging area whether it is tracked or untracked.

    To see the differences between the last check in and the staging area do git diff --cached.

    To see the differences between the staging area and your working copy, do git diff. If there is nothing in the staging area then this is the same as doing a diff between the last check in and your working copy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like that whenever I run git diff or git show it silently
Every time I run git diff, for each single changes I made, I get
when I run git diff FETCH_HEAD it lists a load of expected changes, since
I am trying to run git from a different directory than I am in.
Do all git commands have a --dry-run option, or one which would indicate what
I need help getting git extensions to run with msysgit. I have had bad
(git version 1.6.5.7) When I run git diff the output has a nice scope
I seem to have run into a case where git doesn't notice inline changes
When I run git status , I see the Untracked files section has many
I would like to run git reset *.foo but this errors out. I think

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.