Read more

Git: How to show only filenames for a diff

Arne Hartherz
April 24, 2013Software engineer at makandra GmbH

When you want to do a git diff but do not care about the full diff and just want to know which files changed, use the --name-only switch:

$ git diff --name-only
app/controllers/sessions_controller.rb
app/models/user.rb
features/sign_in.feature
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

To include some brief information about changed lines, use the --stat switch:

$ git diff --stat
app/controllers/sessions_controller.rb |    8 +-
app/models/user.rb                     |   30 ++++
features/sign_in.feature               |  136 +++++++++++++++++

The output of --stat is nicely colored. If you want a more machine-readable output, use the --numstat switch:

$ git diff --numstat
4       4       app/controllers/sessions_controller.rb
18      12      app/models/user.rb
123     13      features/sign_in.feature
Posted by Arne Hartherz to makandra dev (2013-04-24 09:50)