Search code examples
gitgit-commitgit-diff

Cannot diff committed changes against remote using git diff


What I want to to is to view the changes committed to my local repo against the remote one.

When I do git status I'm getting:

On branch develop  
Your branch is ahead of 'origin/develop' by 6 commits.  
  (use "git push" to publish your local commits)  
  nothing to commit, working directory clean  

As discussed in How do I show the changes which have been staged?

One (two) of the git diffs should work. Unfortunately in my case all of them return nothing.

git diff //empty - which seems to be fine 
git diff --cached //empty 
git diff HEAD //empty

Am I missing something?


Solution

  • You have already committed your changes.

    Diff will show you the difference between your index and the repository.

    If you want to view the changes between your local repository to the remote repository do this:

    git fetch --all --prune
    git log ^master origin/master
    
    // or:
    git log master ^origin/master
    

    The difference between the two lines is that one will display the pull diff while the second one will display the push diff.