OthersOverleaf and git: how to check out old revisions

Information and discussion about other LaTeX editors not listed above
Post Reply
lesk
Posts: 3
Joined: Wed May 06, 2020 2:51 pm

Overleaf and git: how to check out old revisions

Post by lesk »

Hi all,

I'm working on overleaf.com and I would like to compare the current text version to an earlier draft using latexdiff. Hence I want to use git to download my project from overleaf at two different revisions.

Cloning my project from overleaf to a local repository is no problem. My problem is that I am new to git and I cannot find a way to rewind the repository to an earlier reference. I tried labeling version on overleaf but the label do not seem to show up consistently in my local repository.

Any idea on how to approach this? Or a better place to ask this question? I realize that this is relates to git more than to latex - but it is very specific to overleaf and hence this forum seems a good place to find expertise…

best wishes
kai

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Overleaf and git: how to check out old revisions

Post by Ijon Tichy »

I don't know how to use git on Overleaf, because I do not use Overleaf. But usually you can checkout a specific commit of a file using git checkout <COMMIT> <FILE>Git: checkout a single file from a specific commit.

BTW: To switch back to HEAD afterwards simply use git-restore or git checkout HEAD <FILE>. To see all the commits of a file, simply use git log <FILE>.

BTW: git-difftool allows to use another diff tool instead of the usual. There has to be a configuration for the tool. And there isn't any default configuration for latexdiff. But I've never examined if such a configuration can be made for latexdiff. Maybe git experts know more about it.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
lesk
Posts: 3
Joined: Wed May 06, 2020 2:51 pm

Overleaf and git: how to check out old revisions

Post by lesk »

Thanks Ijon, very helpful. I'm not quite there yet because the log does not show the commits that I am interested in. I've contacted overleaf support and will follow up here if I learn more.
lesk
Posts: 3
Joined: Wed May 06, 2020 2:51 pm

Overleaf and git: how to check out old revisions

Post by lesk »

Overleaf Support promptly got back to me – as it turns out, Overleaf only creates "git commits" when a specific commit is explicitly pulled or pushed (this is because they do not use git internally). Or when a specific (current) revision is labeled (but no commit is created when an earlier revision from the history is labeled).

So my work-around will be to check out ZIP archives of the two versions that I want to compare.
best wishes
kai
Post Reply