Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9260453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:53:45+00:00 2026-06-18T12:53:45+00:00

I want to suppress all the output for files in dir/* when using the

  • 0

I want to suppress all the output for files in

    dir/* 

when using the command

    git diff

I decided to follow the suggestions from
Excluding files from git-diff

Method 1.

Adding to .git/config

[alias]
    mydiff = !git diff -- $(git diff --name-only | grep -Ev "dir/")

and using

git mydiff

worked as expected and thus solved my problem. However, I wanted to use Method 2.

Method 2.

Adding to .gitattributes

dir/* -diff

and then using

git diff

Produces the output

diff --git a/dir/1 b/dir/1
deleted file mode 100644
index 05e9130..0000000
...

Question
How to suppress this undesired output for all the files in dir/?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:53:47+00:00Added an answer on June 18, 2026 at 12:53 pm

    The reason you see output with your settings is that dir/* -diff only marks files in dir as binary files, so text diff would not apply to them (see man 5 gitattributes).

    To suppress any output for files in dir you have to define an external diff driver like this:

    1. Assign new “silent” (you can choose your name) diff driver:

      $ cat .gitattributes 
      dir/* diff=silent
      
    2. Define “silent” diff function:

      $ tail -n2 .git/config
      [diff "silent"]
          command = "true"
      

    That should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using -Werror to treat all warning as errors, I don't want to suppress a
I'm trying to suppress the command-line from the output in Visual Studio - my
I'm using a find command to find all files of a certain format, that
I am want to suppress all the errors that could appear in my VBS
Possible Duplicate: R suppress startupMessages from dependency I've read about using sink(NUL) / sink(/dev/null)
I want to source a javascript file from facebook http://connect.facebook.net/en_US/all.js The organization I work
I simply want my method call to suppress all NoMethodError exceptions that might arise
I want to suppress the The resource name 'X.Y' is not a valid identifier
I want to suppress page number in a page where a figure covers the
I have several Code Analysis CA1704:IdentifiersShouldBeSpelledCorrectly warnings that I want to suppress. Basically, they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.