Chapter 10Supporting Files in Git

In this chapter, I explore two types of supporting files that allow users to customize how Git interacts with different kinds of content. The Git attributes file allows you to define settings to apply to certain operations for particular files or file types. The Git ignore file allows you to tell Git which files it should ignore and not try to manage. I cover the intent, usage, scope, and format for both types of files.

Having these two files with each repository is a best practice for Git. There are also many customized versions that have been created by users for different types of work. For example, an attributes file for Java development could include specifications on line endings for *.java files. The corresponding ignore file could include lines to tell Git not to track or manage *.jar, *.war, and other files, because those are generated files in the java workflow.

Over the years, Git users doing different kinds of development have created versions of these files that have worked well for them. In the spirit of open source, users commonly contribute the files that they have used back to public places on the Internet. One popular site for these contributions from users is GitHub. Normally, ...

Get Professional Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.