Get all files that have been modified in git branch

后端 未结 16 1657
深忆病人
深忆病人 2020-12-02 04:14

Is there a way to see what files have changed in a branch?

16条回答
  •  误落风尘
    2020-12-02 04:51

    The following batch file is based on twalberg's answer but will work in Windows:

    @ECHO OFF
    C:                               :: <== OR USE A DIFFERENT DRIVE
    CD \path\to\where\git\files\are  :: <== CHANGE TO THE ACTUAL PATH
    SET /p b="Enter full path of an ALREADY MERGED branch to compare with origin/master: "
    bash --login -i -c "git diff --name-only %b% $(git merge-base %b1% origin/drop2/master)"
    PAUSE
    

    The above assumes that the main branch is origin/master and that git bash was included when Git was installed (and its location is in the path environment). I actually needed to show the actual differences using a configured diff tool (kdiff3) so substituted the following bash command above:

    bash --login -i -c "git difftool --dir-diff %b% $(git merge-base %b1% origin/drop2/master)"
    

提交回复
热议问题