search

Home  >  Q&A  >  body text

git-diff - git diff checks the differences between two branches and how to output the results to a specified file

git diff [branchA] [branchB]

Using the above command can output the difference between the two branches, but there are too many different files, and it is not very convenient to view it on the command line. I want to output it to a file for viewing, but I don’t know how to add parameters?

====================================
Additional: Found the answer:

// >> 后加输出文件的路径、文件名和后缀名
 git diff [branchA] [branchB] >>d:/diff/exportname.diff
黄舟黄舟2813 days ago807

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-05-02 09:33:44

    Linux redirection command
    override git diff [branchA] [branchB] > a.txt
    append git diff [branchA] [branchB] >> a.txt

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-02 09:33:44

    git diff --color > foo.diff

    foo.diff is opened with an editor like notepad++/sublime and the color is highlighted

    reply
    0
  • Cancelreply