How can I view new files that would be introduced on merging branches?

Imagine a branch named A. We fork a branch named B from it, and we commit stuff around. Some of the commits are modifiying existing files, while some of them will be introducing new files.

If I switch back from B to A, is there a way to find out what new files B will introduce when I merge them?

  • Intellij - switching between multiple git local branches
  • Any reason against switching from svn to Git Version Control?
  • repo for all except some projects not all. is there a repo command to do this?
  • Git, get unchaged files between commits
  • Issue cloning github repository with Username/Password
  • git post-receive not working correctly
  • How do I list branches that have been pushed to a remote?
  • Tell git not to merge binary files but to choose
  • Restore files removed by Git checkout
  • make head stop waiting for input
  • Git pulling and pushing when working in a team
  • Continuously deploy two branches to two separate openshift applications on Travis CI?
  • 3 Solutions collect form web for “How can I view new files that would be introduced on merging branches?”

    You can run git merge --no-commit --no-ff B, then see the changes and then rollback, or you can try git diff between last commits in A and B branches and examine this diff on order to see new files. If your branch B is branched from HEAD of branch A, there should not be any conflicts in git diff would run fine.

    The --stat option for git diff will give you a list:

    git diff --stat A..B
    

    use the --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]] option of git diff to filter out the A added files, or whichever is the important one for you.

    Git Baby is a git and github fan, let's start git clone.