RE: Feature Request
On Thursday, June 20, 2024 8:58 AM. Clement Sello Tsetsa wrote:
Show 15 quoted lines
>My name is Clement and I am a second year student at NWU university in South
>Africa studying towards a bachelor's degree in information technology, i just
>recently learned about Git and it is a fascinating piece of technology. This is my first
>time making a feature request for anything and please excuse me if it is not up to
>your standards in any way. Please read the below text as it is the feature request:
>
>When initializing a Git repository, allow specifying file types to track using the
>command git init <file>. If no file type is specified, Git should track all file types by
>default. Additionally, automatically create the .gitignore file during initialization, and
>as new file types are created, add them to the ignore list. Later, when adding files to
>the staging environment, Git will already know which types to include or ignore
>using the git add <file> command.
>
>I think the user should not have to create the .gitignore file in the future if this is
>implementable.
Can you clarify what you mean by "file types"? In a cross-platform distributed situation, file types can be interpreted as a combination of file extensions, file encodings, and internal contents. .gitignore only deals with name matching patterns, so cannot reflect inclusion of exclusion of internal content types (for example *.doc with UTF-8 vs. US-ASCII content).
This is an interesting idea but seems to require that git build a generic mechanism for determining file types on all supported platforms and extending .gitignore to represent internal types . This is definitely non-trivial. In Linux, for example, the 'file' command can determine the internal guts of some files, as in:
$ file myfile myfile: TNS/X PIC object format,64-bit data model,executable,NonStop OSS target
Note that there is no file extension above.
Can you please clarify what you are looking for in this area?
I would also suggest that you look into both git templates and git hooks. The combination might help cover at least part of this. Specifically, the pre-commit hook might help with management of the .gitignore file.
Regards, Randall