git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Automatically Add .gitignore Files

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 8, 2017, 23:39 UTC
Message-ID
<xmqqmvdwtfq8.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAANrE7rmUZcJkw+thMczv3D=7sqcUHBsorzvEZgYg=6AEfrU=w@mail.gmail.com>
Thangalin <thangalin@gmail.com> writes:
Show 5 quoted lines
> I frequently forget to add .gitignore files when creating new .gitignore files.
>
> I'd like to request a command-line option to always add .gitignore
> files (or, more generally, always add files that match a given file
> specification).

That is essentially what "Untracked files" listing in the editor buffer given to you when you type "git commit" is about. By not saying you ignore .gitattributes, .gitignore, .gitmodules, etc., you are reminded if you forgot to add them. "git status" does the same, and perhaps you want to make it a habit to run it before committing.

I am tempted to say that there should be a way to somehow forbid use of the "-m" option to "git commit" by default, until the user gains more familiarity with use of Git. That way, they will learn to pay more attention to the "Untracked" and "Changes not staged" sections ;-)

Previous: ThangalinNext: Stephan Beyer
Message 2 of 5 in “Automatically Add .gitignore Files”
  1. ThangalinFeb 8, 2017
  2. Junio C HamanoFeb 8, 2017
  3. Stephan BeyerFeb 9, 2017
  4. Duy NguyenFeb 9, 2017
  5. ThangalinFeb 9, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.