Skip to contentSkip to conversation

.gitignore: don't ignore .gitattributes files

PATCH In review Rasmus Villemoes 2 participants 3 messages Jul 18, 2025 – Jul 29, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 .gitignore: don't ignore .gitattributes files

In a private fork, it's not unreasonable to commit various binary files associated to one's project, and thus put a suitable .gitattributes file next to it to force git to treat that file as binary. In my case, I have a .xslx spreadsheet used for computing suitable RAM timing tables, which I wanted to put in board/<vendor>/<project>. Git duly warned me that it would do LF/CRLF mangling, so I also added a .gitattributes file next to it with

*.xlsx binary

but upon adding that file, git told me that I'd have to use -f because it's a dot-file that is by default ignored.

Add .gitattributes to the list of dot-files that should not be ignored.

While in here, sort the list and update the comment, as there are also files which git itself does not make use of in the list, cf. linux commit f46e65da48b2 (".gitignore: exclude .get_maintainer.ignore and .gitattributes").

---
 .gitignore | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
.gitignore +3 -2
index bb03833b5f2..6d85b3aa238 100644
@@ -56,11 +56,12 @@ fit-dtb.blob*
 /*.log
 
 #
-# git files that we don't want to ignore even it they are dot-files
+# We don't want to ignore the following even if they are dot-files
 #
+!.get_maintainer.*
+!.gitattributes
 !.gitignore
 !.mailmap
-!.get_maintainer.*
 
 #
 # Generated files
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Rasmus Villemoes

In a private fork, it's not unreasonable to commit various binary files associated to one's project, and thus put a suitable .gitattributes file next to it to force git to treat that file as binary. In my case, I have a .xslx spreadsheet used for computing suitable RAM timing tables, which I wanted to put in board/<vendor>/<project>. Git duly warned me that it would do LF/CRLF mangling, so I also added a .gitattributes file next to it with

*.xlsx binary

but upon adding that file, git told me that I'd have to use -f because it's a dot-file that is by default ignored.

Add .gitattributes to the list of dot-files that should not be ignored.

Quoted 6 lines

While in here, sort the list and update the comment, as there are also files which git itself does not make use of in the list, cf. linux commit f46e65da48b2 (".gitignore: exclude .get_maintainer.ignore and .gitattributes").

Signature · 1 line
Tom
#2 lore raw
In reply to Rasmus Villemoes
Quoted 9 lines · Rasmus Villemoes

In a private fork, it's not unreasonable to commit various binary files associated to one's project, and thus put a suitable .gitattributes file next to it to force git to treat that file as binary. In my case, I have a .xslx spreadsheet used for computing suitable RAM timing tables, which I wanted to put in board/<vendor>/<project>. Git duly warned me that it would do LF/CRLF mangling, so I also added a .gitattributes file next to it with

[...]

Applied to u-boot/master, thanks!

[1/1] .gitignore: don't ignore .gitattributes files

      commit: 51013e7bfb3697f2ac1dd82843a67ebd76925450
Signature · 1 line
Tom