GITATTRIBUTES(5) Git Manual GITATTRIBUTES(5) (NAME) gitattributes - (SYNOPSIS) $GIT_DIR/info/attributes, .gitattributes (DESCRIPTION) gitattributes (attributes) . gitattributes : pattern attr1 attr2 ... (pattern) (whitespace) . . # . C . . : (Set) "true" . (Unset) "false" - . (Set to a value) = . (Unspecified) Unspecified . (override) . . .gitignore ( gitignore(5) ) : o . o ( path/ path/** ). Git $GIT_DIR/info/attributes ( ) .gitattributes ( .gitattributes ) . (global) (system-wide) ( ). .gitattributes (index) . (checkout) .gitattributes . ( ) $GIT_DIR/info/attributes . ( ) .gitattributes . core.attributesFile ( git-config(1) ). $XDG_CONFIG_HOME/git/attributes . $XDG_CONFIG_HOME $HOME/.config/git/attributes . $(prefix)/etc/gitattributes . Unspecified . ! . BUILTIN_* (RESERVED BUILTIN_* ATTRIBUTES) builtin_* . . builtin_objectmode (40000, 120000, 160000, 100755, 100644) :(attr:builtin_objectmode=160000). git check-attr builtin_objectmode -- . git check-attr --cached unspecified . (EFFECTS) Git . . (Checking-out and checking-in) git switch git checkout git merge . Git git add git commit . text (end-of-line) : LF . eol Git LF CRLF ( eol ). (Set) text . LF CRLF Git . (Unset) text Git . "auto" text "auto" Git . CRLF Git . . (Unspecified) text Git core.autocrlf . Git text . eol . text text=auto eol text text . "crlf" CRLF . "lf" . (Unspecified) eol core.autocrlf core.eol ( git-config(1) ). text eol=crlf eol=lf . crlf crlf : crlf text -crlf -text crlf=input eol=lf (End-of-line conversion) Git LF CRLF . CRLF "core.autocrlf" . [core] autocrlf = true LF . text "auto" . * text=auto . Git .txt .vcproj .sh .vcproj CRLF .sh LF .jpg . * text=auto *.txt text *.vcproj text eol=crlf *.sh text eol=lf *.jpg -text text=auto push pull CRLF . : $ echo "* text=auto" >.gitattributes $ git add --renormalize . $ git status # $ git commit -m "Introduce end-of-line normalization" git status git add -u text . manual.pdf -text Git . weirdchars.txt text core.safecrlf "true" "warn" Git core.autocrlf . "true" "warn" . : o git add o git apply CRLF o git diff git add . working-tree-encoding Git ASCII ( UTF-8 ISO-8859-1 ...) . ( UTF-16) Git ( git diff) Git . working-tree-encoding Git . Git Git UTF-8 (re-encode) . UTF-8 ( "index") . (checkout) . working-tree-encoding : o Git ( JGit libgit2) Git ( ) working-tree-encoding . . Microsoft Visual Studio (*.rc) PowerShell (*.ps1) UTF-16 . *.ps1 UTF-16 foo.ps1 working-tree-encoding foo.ps1 UTF-8 . foo.ps1 UTF-8 . bar.ps1 ( UTF-16). UTF-8 UTF-16 . o UTF UTF-8 . core.checkRoundtripEncoding Git ( git- config(1) ). SHIFT-JIS ( ) UTF-8 . o Git ( git checkout git add). working-tree-encoding UTF-8 Git . *.ps1 UTF-16 (BOM) Git : *.ps1 text working-tree-encoding=UTF-16 *.ps1 UTF-16 little endian BOM Git ( BOM UTF-16LE-BOM UTF-16LE ). eol working-tree-encoding . *.ps1 text working-tree-encoding=UTF-16LE eol=crlf : iconv --list file : file foo.ps1 ident ident Git $Id$ blob $Id: blob $ . $Id: $ $Id$ . filter filter (filter driver) . clean smudge . smudge blob . clean . blob . process clean / smudge Git blob Git ( git add --all) . . process . . " " " ". . ( UUID Git ) ( ). . (no-op passthru) . filter..required true . : clean : $ git add --renormalize . .gitattributes filter : *.c filter=indent .git/config "filter.indent.clean" "filter.indent.smudge" C ( "clean") ( "cat") . [filter "indent"] clean = indent smudge = cat clean ("clean->clean" "clean" ) smudge clean ("smudge->smudge->clean" "clean" ). . "indent" : . smudge clean . required : [filter "crypt"] clean = openssl enc ... smudge = openssl enc -d ... required "%f" . . : [filter "p4"] clean = git-p4-filter --clean %f smudge = git-p4-filter --smudge %f "%f" . . smudge clean . (Long Running Filter Process) ( ) filter..process Git blob Git . ( Documentation/technical/long-running-process-protocol.adoc ). Git clean smudge (handshake) . Git "git-filter-client" "clean" "smudge" "delay" . Git "key=value" (flush packet) . . Git pkt-line . . "value" "key=value" "=" . packet: git> command=smudge packet: git> pathname=path/testfile.dat packet: git> 0000 packet: git> CONTENT packet: git> 0000 "key=value" . "status=success" . pkt-line . "key=value" . ( ). packet: git< status=success packet: git< 0000 packet: git< SMUDGED_CONTENT packet: git< 0000 packet: git< 0000 # "status=success" ! "success" . packet: git< status=success packet: git< 0000 packet: git< 0000 # ! packet: git< 0000 # ! "status=error" . packet: git< status=error packet: git< 0000 "error" ( ) . packet: git< status=success packet: git< 0000 packet: git< HALF_WRITTEN_ERRONEOUS_CONTENT packet: git< 0000 packet: git< status=error packet: git< 0000 Git "status=abort" . packet: git< status=abort packet: git< 0000 "error"/"abort" Git . Git filter..required . Git . filter..required . (Delay) "delay" Git "can-delay" . blob ( ) "delayed" . packet: git> command=smudge packet: git> pathname=path/testfile.dat packet: git> can-delay=1 packet: git> 0000 packet: git> CONTENT packet: git> 0000 packet: git< status=delayed packet: git< 0000 "delay" "list_available_blobs" . Git . "success" . . Git . Git . packet: git> command=list_available_blobs packet: git> 0000 packet: git< pathname=path/testfile.dat packet: git< pathname=path/otherfile.dat packet: git< 0000 packet: git< status=success packet: git< 0000 Git . . (smudge) . packet: git> command=smudge packet: git> pathname=path/testfile.dat packet: git> 0000 packet: git> 0000 # ! packet: git< status=success packet: git< 0000 packet: git< SMUDGED_CONTENT packet: git< 0000 packet: git< 0000 # ! contrib/long-running-filter/example.pl Git . GIT_TRACE_PACKET ( git(1) ). filter..clean filter..smudge filter..process . / (check-in) filter ( ) ident ( ) text ( ) . (check-out) blob text ident filter . / ( clean/smudge text/eol/ident) (merge conflicts) . merge.renormalize Git . . "smudge->clean" "clean" . . (Generating diff text) diff diff (diffs) Git . Git . (hunk header) @@ -k,l +n,m @@ Git Git . (Set) diff ( NUL). (Unset) diff Binary files differ ( ). (Unspecified) diff core.bigFileThreshold . Binary files differ . (String) (diff driver) . "foo" "diff.foo" Git . gitconfig gitattributes. : jcdiff $GIT_DIR/config ( $HOME/.gitconfig) : [diff "jcdiff"] command = j-c-diff Git diff=jcdiff (j-c-diff) GIT_EXTERNAL_DIFF. git(1) . ( git diff --ignore-space-change) trustExitCode true . . diff.algorithm . minimal .json histogram .c . .gitattributes diff : *.json diff= "diff..algorithm" myers patience minimal histogram. [diff ""] algorithm = histogram git-diff(1) git-show(1) --stat . . diff..command diff= diff..algorithm . (Custom Hunk-Header) ( "hunk" ) diff : @@ -k,l +n,m @@ TEXT (hunk header) . "TEXT" (_) ($) . . .gitattributes diff : *.tex diff=tex "diff.tex.xfuncname" (regular expression) . $GIT_DIR/config ( $HOME/.gitconfig) : [diff "tex"] xfuncname = "^(\\\\(sub)*section\\{.*)$" : . tex ( .gitattributes ). : o ada Ada. o bash Bourne-Again SHell. POSIX . o bibtex BibTeX. o cpp C ++C. o csharp #C. o css (CSS). o dts devicetree (DTS). o elixir Elixir. o fortran Fortran. o fountain Fountain. o golang Go. o html HTML/XHTML. o java Java. o kotlin Kotlin. o markdown Markdown. o matlab MATLAB Octave. o objc Objective-C. o pascal Pascal/Delphi. o perl Perl. o php PHP. o python Python. o ruby Ruby. o rust Rust. o scheme Lisp Scheme Emacs Lisp Common Lisp Clojure. o tex LaTeX. (Customizing word diff) git diff --word-diff "diff.*.wordRegex" . : [diff "tex"] wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+" . . ASCII . ( ). textconv . ( ) stdout . exif : [diff "jpg"] textconv = exif . textconv patch . git diff git log git format-patch . Git (cache) . "cachetextconv" : [diff "jpg"] textconv = exif cachetextconv = true "exif" . git update-ref -d refs/notes/textconv/jpg . textconv . textconv : 1. : diff . 2. Git diff: word-diff . 3. : textconv git log -p . diff .gitattributes : *.ps -diff Git Binary files differ . textconv diff.*.binary : [diff "ps"] textconv = ps2ascii binary = true (Performing a three-way merge) merge merge git merge git revert git cherry-pick . (Set) merge RCS . . (Unset) . . (Unspecified) . merge.default . (String) . "text" " " "binary" . merge : text . <<<<<<< ======= >>>>>>> . binary . union . . .git/config . filfre : [merge "filfre"] name = feel-free merge driver driver = filfre %O %A %B %L %P recursive = binary merge.*.name . `merge.*.driver` (%O) (%A) (%B) . . %L . %A . merge.*.recursive . %P . %S %X %Y . conflict-marker-size ( ). Documentation/git-merge.adoc conflict-marker-size=32 (Checking whitespace errors) whitespace core.whitespace diff apply ( git-config(1) ). . (Set) Git . (Unset) . (Unspecified) core.whitespace . (String) core.whitespace . (Creating an archive) export-ignore export-ignore . export-subst export-subst Git (placeholder) . --pretty=format: git- log(1) $Format:PLACEHOLDERS$ ( $Format:%H$ ). (Packing objects) delta delta false . (Viewing files in GUI tools) encoding ( gitk(1) git-gui(1)) . gui.encoding . (USING MACRO ATTRIBUTES) . : *.jpg -text -diff . . binary : *.jpg binary "binary" "text" "diff" . "Set" . (DEFINING MACRO ATTRIBUTES) gitattributes ($GIT_DIR/info/attributes .gitattributes /). "binary" : [attr]binary -diff -merge -text (NOTES) Git .gitattributes (symbolic links) . (EXAMPLES) gitattributes : ( $GIT_DIR/info/attributes) a* foo !bar -baz ( .gitattributes) abc foo bar baz ( t/.gitattributes) ab* merge=filfre abc -foo -bar *.c frotz t/abc : 1. t/.gitattributes ( ) merge . foo bar . 2. .gitattributes ( ) . t/.gitattributes merge foo bar foo bar baz . 3. $GIT_DIR/info/attributes . foo bar baz . t/abc : foo set to true bar unspecified baz set to false merge set to string value "filfre" frotz unspecified (SEE ALSO) git-check-attr(1). (GIT) git(1) Git 2.55.0 2026-06-29 GITATTRIBUTES(5)