Compare Working Directory file with remote repository file

1

How to compare a local file, in the Working Directory, with an existing file in a remote repository, for example GitHub?

I need to identify changes made to a local file compared to the version in GitHub. I have not yet run the git add command on this file, so it is still in the Working Directory.

    
asked by anonymous 10.04.2015 / 21:16

1 answer

3
Imagine that you are working on the master branch on the remote called origin , it would look like this:

  • Update your master branch with the latest changes in GitHub

    git fetch origin master

  • Do the diff to see what has changed between the files in the working directory and master :

    git diff origin/master

  • 11.04.2015 / 02:10