git: diff between file in local repo and origin

后端 未结 7 2144
我在风中等你
我在风中等你 2020-12-04 04:42

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, howev

7条回答
  •  悲哀的现实
    2020-12-04 05:17

    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:
    

    Note 2: master can be replaced in the above examples with any branch name

提交回复
热议问题