I want to find the differences between a file I have in my local repo vs what is in the origin master
.
I know that there is git diff
, however I just want to isolate it down to this one particular file.
For simplicity lets say the file is named file1.txt
and it has a local file path = [local_path]
and in the origin it has filepath = [remote-path]
.
What would be the git command I need to type?
EDIT: Thank you all for your input it has been very insightful. For those that are using Eclipse (which I am and I should have stated earlier) I just found out that you can just rightclick -> Compare With -> Branch, Tag or Reference -> select appropriate version and there you go.
If [remote-path]
and [local-path]
are the same, you can do
$ git fetch origin master
$ git diff origin/master -- [local-path]
Note 1: The second command above will compare against the locally stored remote tracking branch. The fetch command is required to update the remote tracking branch to be in sync with the contents of the remote server. Alternatively, you can just do
$ git diff master:<path-or-file-name>
Note 2: master
can be replaced in the above examples with any branch name