TransWikia.com

diff against the working directory with git-latexdiff

TeX - LaTeX Asked by user2740 on January 28, 2021

I use git for my latex document and I want to diff against the working directory.
MWE:

documentclass{article}
begin{document}
  a
end{document}

add git-latexdiff to $PATH in .bashrc

PATH=$PATH:~/path/to/dir/git-latexdiff/

setup git:

git init; git add .; git commit -m "initial commit"

change content of file from a to aa

git add file.tex; git commit -m "2nd commit"

change content of file from aa to aaa

(use git log to see hashes for commits)

git-latexdiff -v --main file.tex hash1 hash2

(-v is verbose, –main specifies the main file, hashes identify commits)
works just fine.

But when I try to commit against the uncommitted working directory:

user2740$ git-latexdiff -v --main file.tex hash1 --
Auto-detecting PDF viewer ... xdg-open.
/usr/bin/latexpand
Creating temporary directories ... done.
Temporary directories: /tmp/git-latexdiff.3840/old and /tmp/git-latexdiff.3840/new
Checking out old and new version ...ln: failed to create symbolic link ‘./file.tex’: File exists

version:

user2740$ git-latexdiff --version
1.0                                  #downloaded 09.05.2014

Works Now:

Make sure to use the latest version!

Execute only in your desired directory even for version information. (at least for version v1.1.2-1-ga985a4f)

2 Answers

Do not ever use "sudo" for any task that creates file in your home directory. "sudo" does not only gives you permissions to do more things, it also executes the command as a different user, so you will end up with files belonging to root on your account. This is not only useless, but actually harmful. Use sudo for administrative tasks (e.g. upgrade you LaTeX install), but not for daily work.

The command git-latexdiff -v --main file.tex hash1 -- just works for me. git-latexdiff does a temporary checkout in a directory with a unique name under /tmp/. Are you using the latest version of git-latexdiff?

Correct answer by Matthieu Moy on January 28, 2021

Try running the git latexdiff command in the root of the Git repository. It worked fine for me this way.

Answered by Weslley S. Pereira on January 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP