Search code examples
gitbranchfile-listing

GIT List all files that have been committed directly to my branch


We have a production branch from which we branch off feature branches.
At certain times we put together a release with all features that are ready for production.
The branches then get merged back to the the production branch.
After that we update the feature branches that were not ready for production by merging the production branch into those feature branches.

What I need is a git command that shows me all files that have been committed directly to the branch I am working on. i.e. without the files that were merged into my branch via other branches.

I've drawn something:
the situation

I need a command that lists all the files that have been committed for the green Branch.
i.e. the files from commits A, B, C and E
I don't need the files that came into the branch from the merge commit D

Thanks in advance


Solution

  • You should be able to see that by doing:

    git diff --name-only upstream-branch...my-branch # it's triple dot
    

    That will list all files that have been changed when comparing with the last commit from the upstream branch that has been merged into your branch... in other words, the changes that have been introduced in your branch only.