LaTeX forum ⇒ OthersOverleaf and git: how to check out old revisions Topic is solved

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

Overleaf and git: how to check out old revisions

Postby lesk » Thu Aug 19, 2021 11:09 am

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

User avatar
Ijon Tichy
Posts: 548
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Thu Aug 19, 2021 11:37 am

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.

lesk
Posts: 3
Joined: Wed May 06, 2020 2:51 pm

Postby lesk » Fri Aug 20, 2021 9:09 am

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

Postby lesk » Mon Aug 23, 2021 8:02 am

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


Return to “Others”

Who is online

Users browsing this forum: No registered users and 3 guests