Get all files that have been modified in git branch

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

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

16条回答
  •  醉梦人生
    2020-12-02 04:54

    Update Nov 2020:

    To get the list of files modified (and committed!) in the current branch you can use the shortest console command using standard git:

    git diff --name-only master...


    • If your local "master" branch is outdated (behind the remote), add a remote name (assuming its "origin") git diff --name-only origin/master...

    • If you want to include uncommitted changes as well, remove the ...:

      git diff --name-only master

    • If you use different main branch name (eg: "main"), substitute it:

      git diff --name-only origin/main...

    • If your want to output to stdout (so its copyable)

      git diff --name-only master... | cat


    per really nice detailed explanation of different options https://blog.jpalardy.com/posts/git-how-to-find-modified-files-on-a-branch/

提交回复
热议问题