How to Diff between local uncommitted changes and origin

后端 未结 4 1387
我在风中等你
我在风中等你 2021-01-29 20:49

Let\'s say I cloned a repository and started modifying files. I know that if I have local uncommitted changes, I can do a diff as follows git diff test.txt and it w

4条回答
  •  一个人的身影
    2021-01-29 20:57

    I know it's not an answer to the exact question asked, but I found this question looking to diff a file in a branch and a local uncommitted file and I figured I would share

    Syntax:

    git diff :./ -- 
    

    Examples:

    git diff origin/master:./ -- README.md
    git diff HEAD^:./ -- README.md
    git diff stash@{0}:./ -- README.md
    git diff 1A2B3C4D:./ -- README.md
    

    (Thanks Eric Boehs for a way to not have to type the filename twice)

提交回复
热议问题