Skip to content

Instantly share code, notes, and snippets.

@slvdrvlc
Forked from vhbsouza/.gitattributes
Created March 10, 2021 03:14
Show Gist options
  • Save slvdrvlc/b55da9df34dfcee9f6c9abdf58a2cb6d to your computer and use it in GitHub Desktop.
Save slvdrvlc/b55da9df34dfcee9f6c9abdf58a2cb6d to your computer and use it in GitHub Desktop.

Revisions

  1. @vhbsouza vhbsouza revised this gist Apr 22, 2016. 2 changed files with 31 additions and 1 deletion.
    2 changes: 1 addition & 1 deletion .gitattributes
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@
    # http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
    * text=auto

    # Documents
    # Documents (about ASTEXTPLAIN: http://stackoverflow.com/questions/28146244/what-is-the-difference-between-diff-and-diff-astextplain)
    *.doc diff=astextplain
    *.DOC diff=astextplain
    *.docx diff=astextplain
    30 changes: 30 additions & 0 deletions astextplain
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #!/bin/sh -e
    # minimalistic replacement for `run-mailcap --action=cat <file>`

    if test "$#" != 1 ; then
    echo "Usage: astextplain <file>" 1>&2
    exit 1
    fi

    # XXX output encoding (UTF-8) hardcoded
    case "$1" in
    *.doc | *.DOC | *.dot | *.DOT)
    antiword -m UTF-8 "$1" || cat "$1"
    ;;
    *.docx | *.DOCX)
    docx2txt "$1" -
    ;;
    *.pdf | *.PDF)
    pdftotext -layout "$1" -enc UTF-8 -
    ;;
    # TODO add rtf support
    *.rtf | *.RTF)
    cat "$1"
    ;;
    *)
    echo "E: unsupported filetype $1" 1>&2
    exit 1
    ;;
    esac

    exit 0
  2. @kenlimmj kenlimmj created this gist Apr 18, 2014.
    50 changes: 50 additions & 0 deletions .gitattributes
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    # Encrypt the repository
    # Remove/modify this line if the repository is meant to be open-source
    *.* filter=git-crypt diff=git-crypt
    .gitattributes !filter !diff

    # These files are text and should be normalized (Convert crlf => lf)
    *.php text
    *.css text
    *.js text
    *.htm text
    *.html text
    *.xml text
    *.txt text
    *.ini text
    *.inc text
    .htaccess text

    # These files are binary and should be left untouched
    # (binary is a macro for -text -diff)
    *.png binary
    *.jpg binary
    *.jpeg binary
    *.gif binary
    *.ico binary
    *.mov binary
    *.mp4 binary
    *.mp3 binary
    *.flv binary
    *.fla binary
    *.swf binary
    *.gz binary
    *.zip binary
    *.7z binary
    *.ttf binary

    # Auto detect text files and perform LF normalization
    # http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
    * text=auto

    # Documents
    *.doc diff=astextplain
    *.DOC diff=astextplain
    *.docx diff=astextplain
    *.DOCX diff=astextplain
    *.dot diff=astextplain
    *.DOT diff=astextplain
    *.pdf diff=astextplain
    *.PDF diff=astextplain
    *.rtf diff=astextplain
    *.RTF diff=astextplain