1

The branch I'm working on is called dev so I did the following to see if there were any differences between what I have on my machine and what is in github:

git fetch origin
git diff dev origin/dev

I did this at a command prompt in windows and after executing each command the cursor went to the next line with no output. Does that mean there are no differences?

2
  • I can't imagine why it shouldn't mean that, but I don't know if there is some obscure corner case. Commented Mar 4, 2021 at 22:19
  • 1
    No, it does not mean that. It means that there are no differences between the working directory and the staging area. If you have staged any changes, you can see those differences with git diff --cached Commented Mar 4, 2021 at 23:16

1 Answer 1

2

git diff, like a regular diff invocation, prints all of the differences, if any, and then exits 0 if there were no changes, exits 1 if there were changes, and exits 2 or greater if there was an error.

So generally, yes, that would mean that there are no changes. There are some uncommon cases where it could also mean something else, such as an error, so if you want to be certain, you should also check that the command exited 0. In a POSIX shell, you can see the exit status of the immediately previous command with echo $?. There is probably a way to do it in CMD or PowerShell, but since I'm not a Windows user, that is left as an exercise to the reader.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.