@@ -24,16 +24,16 @@ Then we can use :doc:`pandas:reference/api/pandas.DataFrame.to_csv` in
2424 :language: python
2525
2626Now add the following section to your global Git configuration
27- :file: `~/.gitconfig `:
27+ :file: `~/.config/git/config `:
2828
2929.. code-block :: ini
3030
3131 [diff " excel" ]
3232 textconv =python3 /PATH/TO/exceltocsv.py
3333 binary =true
3434
35- Finally, in the global :file: `~/.gitattributes ` file, our ``excel `` converter is
36- linked to :file: `*.xlsx ` files:
35+ Finally, in the global :file: `~/.config/git/attributes ` file, our ``excel ``
36+ converter is linked to :file: `*.xlsx ` files:
3737
3838.. code-block :: ini
3939
@@ -56,15 +56,16 @@ For this, ``pdftohtml`` is additionally required. It can be installed with
5656
5757 $ brew install pdftohtml
5858
59- Add the following section to the global Git configuration :file: `~/.gitconfig `:
59+ Add the following section to the global Git configuration
60+ :file: `~/.config/git/config `:
6061
6162.. code-block :: ini
6263
6364 [diff " pdf" ]
6465 textconv =pdftohtml -stdout
6566
66- Finally, in the global :file: `~/.gitattributes ` file, our ``pdf `` converter is
67- linked to :file: `*.pdf ` files:
67+ Finally, in the global :file: `~/.config/git/attributes ` file, our ``pdf ``
68+ converter is linked to :file: `*.pdf ` files:
6869
6970.. code-block :: ini
7071
@@ -73,10 +74,12 @@ linked to :file:`*.pdf` files:
7374 Now, when ``git diff `` is called, the PDF files are first converted and then a
7475diff is performed over the outputs of the converter.
7576
76- … for Word documents
77- --------------------
77+ .. _pandoc-to-markdown :
7878
79- Differences in Word documents can also be displayed. For this purpose `Pandoc
79+ … for documents
80+ ---------------
81+
82+ Differences in documents can also be displayed. For this purpose `Pandoc
8083<https://pandoc.org/> `_ can be used, which can be easily installed with
8184
8285.. tab :: Debian/Ubuntu
@@ -97,24 +100,92 @@ Differences in Word documents can also be displayed. For this purpose `Pandoc
97100 <https://github.com/jgm/pandoc/releases/> `_.
98101
99102Then add the following section to your global Git configuration
100- :file: `~/.gitconfig `:
103+ :file: `~/.config/git/attributes `:
101104
102105.. code-block :: ini
103106
104- [diff " word" ]
105- textconv =pandoc --to =markdown
106- binary =true
107- prompt =false
107+ [diff " pandoc-to-markdown" ]
108+ textconv = pandoc --to markdown
109+ cachetextconv = true
108110
109- Finally, in the global :file: `~/.gitattributes ` file, our ``word `` converter is
110- linked to :file: `*.docx ` files:
111+ Finally, in the global :file: `~/.config/git/attributes ` file, our
112+ ``pandoc-to-markdown `` converter is linked to :file: `*.docx `, :file: `*.odt ` and
113+ :file: `*.rtf ` files:
111114
112115.. code-block :: ini
113116
114- *.docx diff =word
117+ *.docx diff =pandoc-to-markdown
118+ *.odt diff =pandoc-to-markdown
119+ *.rtf diff =pandoc-to-markdown
120+
121+ .. tip ::
122+ :doc: `Jupyter Notebooks <jupyter-tutorial:notebook/index >` write to a JSON
123+ file :ref: `*.ipynb <jupyter-tutorial:whats-an-ipynb-file >`, which is quite
124+ dense and difficult to read, especially with diffs. The Markdown
125+ representation of Pandoc simplifies this:
126+
127+ .. code-block :: ini
128+
129+ *.ipynb diff =pandoc-to-markdown
115130
116131 The same procedure can be used to obtain useful diffs from other binaries, for
117132example ``*.zip ``, ``*.jar `` and other archives with ``unzip `` or for changes in
118133the meta information of images with ``exiv2 ``. There are also conversion tools
119134for converting ``*.odt ``, ``*.doc `` and other document formats into plain text.
120135For binary files for which there is no converter, strings are often sufficient.
136+
137+ .. _exiftool :
138+
139+ … for media files
140+ -----------------
141+
142+ `ExifTool <https://exiftool.org >`_ can be used to convert the metadata of media
143+ files to text.
144+
145+ .. tab :: Debian/Ubuntu
146+
147+ .. code-block :: console
148+
149+ $ sudo apt install libimage-exiftool-perl
150+
151+ .. tab :: macOS
152+
153+ .. code-block :: console
154+
155+ $ brew install exiftool
156+
157+ .. tab :: Windows
158+
159+ .. code-block :: ps1
160+
161+ > choco install exiftool
162+
163+ .. seealso ::
164+ * `Installing ExifTool <https://exiftool.org/install.html >`_
165+
166+ You can then add the following section to the global Git configuration file
167+ :file: `~/.config/git/config `:
168+
169+ .. code-block :: ini
170+
171+ [diff " exiftool" ]
172+ textconv = exiftool --composite -x ' Exiftool:*'
173+ cachetextconv = true
174+ xfuncname = " ^-.*$"
175+
176+ Finally, in :file: `~/.config/git/attributes ` the ``exiftool `` converter is
177+ linked to file endings of media files:
178+
179+ .. code-block :: ini
180+
181+ *.avif diff =exiftool
182+ *.bmp diff =exiftool
183+ *.gif diff =exiftool
184+ *.jpeg diff =exiftool
185+ *.jpg diff =exiftool
186+ *.png diff =exiftool
187+ *.webp diff =exiftool
188+
189+ .. seealso ::
190+ ``exiftool `` can process many more media files. You can find a complete list
191+ in `Supported File Types <https://exiftool.org/#supported >`_.
0 commit comments