37

I have two branches: master and bug1. I checked out bug1, did bunch of changes and multiple commits. How do I get a list of all files that were changed on the branch? I'm not interested in hashes, dates or any other commit related details. I just want to get a simple list of touched files.

zaza
  • 1,259
  • 2
  • 12
  • 21

2 Answers2

64
git diff --name-only master bug1
Cory Petosky
  • 12,089
  • 2
  • 37
  • 43
  • This works for me. This other SO link http://stackoverflow.com/questions/10641361/git-get-all-files-that-have-been-modified-in-branch was overkill for my purposes. Cory's answer here was succinct and concise, and still works in Sept of 2015! – Eric Hepperle - CodeSlayer2010 Sep 10 '15 at 20:03
  • 4
    if commits have been added to master (not related to bug1) wouldn't they show up as well? – NSjonas Apr 04 '16 at 23:25
  • Yes, if you've pulled and master has changed, you'll see those diffs as something like "reverse diffs". But ideally, if you've pulled changes from a remote and updated master, you should also rebase/ff-merge those changes into your bug1 branch as well. If you do the whole process, the diff works as expected. – Cory Petosky Apr 06 '16 at 00:42
10

From your master:

git diff --name-status BRANCH

See the git diff man page for details.

Arthur
  • 1,281
  • 1
  • 12
  • 17
Tim Henigan
  • 57,640
  • 11
  • 83
  • 76