3

Suppose I have created a *.tex file today.

I make some changes tomorrow and then some more after two days. I think, it's useful if there is a record of what I have added on particular day.

Is there a way to keep track of changes made to a *.tex file?

One stupid solution I can think of for this situation is to create new blank file every time you want to make changes and copy content of old file to this blank file.

Are there other ways to keep track of what has been done to a *.tex file?

I am more interested in keeping tack of changes and not interested in having access to the file everywhere. I am already using Dropbox for the purpose of accessing my files wherever I want. I am happy with the answers. Are there any ways other than git or something along same line?

naphaneal
  • 2,614
  • 5
    use a source control system such as git or svn that is exactly what they do. – David Carlisle Dec 17 '19 at 17:21
  • 1
    for example the last 2256 edits to the latex sources are https://github.com/latex3/latex2e/commits/master – David Carlisle Dec 17 '19 at 17:23
  • By the way, svn is short for Subversion. This kind of software is known as VCS or RCS (version control system, revision control system). – frougon Dec 17 '19 at 17:24
  • @David Thanks for your comment. I have no Idea about git or SVN. I heard these terms many times but don't understand much about it. Can you kindly make your comment as an answer and give some more details – Praphulla Koushik Dec 17 '19 at 17:24
  • This is off topic on this forum, but there are online books here (Git) and there (Subversion). – frougon Dec 17 '19 at 17:27
  • @frougon I do not understand what is off topic on this forum? – Praphulla Koushik Dec 17 '19 at 17:29
  • 3
    how to use git or svn is off topic as it is unrelated to tex, the systems apply to any text files they could be just .txt files or html pages or c programs etc. – David Carlisle Dec 17 '19 at 17:30
  • Even on dropbox you can see the changes of files. It is much less elaborate than git and so on, but also simpler to use. –  Dec 17 '19 at 17:56
  • @Schrödinger'scat Hello. I did not knew I can keep track of history in Dropbox... I will check about it. If I ask how does Dropbox keep track then it would be off topic here. – Praphulla Koushik Dec 17 '19 at 18:03
  • It probably is. I put only the TeX files on dropbox and link them via soft links to local directories, in which I compile them. That way none of the aux and so on files is on dropbox, and it is really easy to share the files with others and to work on them (more or less) simultaneously. –  Dec 17 '19 at 18:07

3 Answers3

8

Use a source control system such as git or svn that is exactly what they do.

How to use such a system is off topic here and too long for an answer, but a popular system these days is github (all the latex base sources are on there)

github has lots of tutorials perhaps start with this

https://guides.github.com/activities/hello-world/

Note that you can use a source control system on your local machine but using a web based server such as github (bitbucket, sourceforge, gitlab, ... are similar sites) you not only get the benefit of being able to track (and possibly revert) all changes but get the benefit that all your revisions are stored off your machine, so if you leave your laptop on the bus, you still have your document and its history.

David Carlisle
  • 757,742
3

If you're using Dropbox, you are offered a basic instance of versioning resp. file history.

Under Windows simply right click on the file and choose History in the context menu. Goto the prefered timestamp and open it in any ASCII based editor, e.g. Notepad++.

If needed, you can diff current and earlier versions on the CLI.

naphaneal
  • 2,614
  • This is what I want. :D I did not knew drop box keeps history (I knew I can go back to just previous one but did not knew I can go back to what I have done 10 days before)... I have trouble understanding "If needed, you can diff current and earlier versions on the CLI." Can you please explain.. – Praphulla Koushik Dec 20 '19 at 03:49
  • @PraphullaKoushik it means, you can use the command line to compare your documents. btw: if the answer is acceptable to you, simply check it. – naphaneal Dec 20 '19 at 20:18
1

Using a version control system needs time and effort. I'm earning my bred with writing letters and contracts and except for larger projects it is enough to

  1. include comments in the *.tex file about what I'm doing why and when
  2. and before I start a major rework of the file, I save the *.tex file with a new version number. My *.tex files usually are named like 191217-blabla-V1.tex. In this example I'd save it as *-V2.tex.
Keks Dose
  • 30,892
  • 1
    "Using a version control system needs time and effort.": I agree that learning how to use them costs a lot, but once you know how to use them, it takes literally no time to track the changes in a file. – Clément Dec 17 '19 at 17:39
  • Do I have to create new copy every time when I want to make changes?? – Praphulla Koushik Dec 17 '19 at 17:42
  • @PraphullaKoushik I usually make a new version every morning. During a day I keep track by leaving comments in the file. – Keks Dose Dec 17 '19 at 17:52
  • @Clément If you are on one pc and you have a local cvs, maybe it is easy. But as soon as you have confidential content and you need encrypted syncs between two computers without a central server, things become messy. – Keks Dose Dec 17 '19 at 17:56
  • @KeksDose You are right. I don't think that this is related to what OP was asking, though. – Clément Dec 17 '19 at 18:13