git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Kirill Sploshnov <sploshnov1998@gmail.com>,  git@vger.kernel.org
Subject: Re: Subject: [RFC] Add config option to enforce committing .gitignore / .gitattributes before other files
Date: Fri, 25 Jul 2025 17:03:44 -0700	[thread overview]
Message-ID: <xmqqa54r3jj3.fsf@gitster.g> (raw)
In-Reply-To: <20250725163650.GA5869@tb-raspi4> ("Torsten Bögershausen"'s message of "Fri, 25 Jul 2025 18:36:50 +0200")

Torsten Bögershausen <tboegi@web.de> writes:

> Since you ask for a new config option: This needs to be applied
> to each and every workstation in use. How could this be done ?
> And if it is done from a central IT department, the there
> may be a way to configure git hooks on the work station.


Unfortunately, I think it is way too naïve an approach to help you
all that much to merely stop you from committing anything before you
have a .gitignore file, because presence of .gitignore is no sign
that you are maintaining a good set of exclusion rules.

Recently in one of my toy projects, where .txt files are build
products (hence I have "*.txt" excluded), I started tracking one
externally-provided tool that is used by the build procedure of the
project, but the tool comes its own "*.txt" template files, which
means "git add NewToolDirectory/" left out half the files that come
with the tool and are essential for the correct operation of that
tool.  Disaster recovery and history rewriting ensued, but the
damage fortunately was small, as I caught it fairly soon before
piling many commits on top.

Instead, you would want to catch a case where "git add" used to add
_new_ files with a rather wide pathspec (e.g., in my case, I named a
single directory and meant to add all the "relevant" files to the
project---the problem was that the definition of "relevant" is
vastly different from the contents that were tracked in the project
historically and what was in the new directory) and ended up
ignoring many files that _would_ have matched the pathspec and
somehow flag it as a potential problem to the user.

Thanks.

      reply	other threads:[~2025-07-26  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 10:40 Subject: [RFC] Add config option to enforce committing .gitignore / .gitattributes before other files Kirill Sploshnov
2025-07-25 16:36 ` Torsten Bögershausen
2025-07-26  0:03   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqa54r3jj3.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sploshnov1998@gmail.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).