-1

A question I frequently ask my terminal is:

What files am I working on? (including committed files)

The answer is usually gotten by this command

git diff my_current_work_branch..master_branch | grep diff

this gives me a crude list of files that I'm currently working on.

Is there a more elegant way to get this info? All I want to ask git is,

what files does this branch add/modify/delete, relative to the master branch.

american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80

2 Answers2

0

diffstat is a handy tool

git diff my_current_work_branch..master_branch` | diffstat -l

will show you each file that's been modified in the diff output.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
0

You can use git diff. If all you want is the names of files that differ, you can use the --name-only.

git diff --name-only master my_branch 

or if you're actually checked out to my_branch

git diff --name-only master HEAD

or if you want to include uncommitted changes

git diff --name-only master
Mark Adelsberger
  • 42,148
  • 4
  • 35
  • 52