![]() |
Working with Git | ![]() |
Git is a version control system: it records successive versions of the files of a project, called commits, in a repository. It allows you to go back to any earlier version, to see who changed what, and to combine the changes of several authors who work on their own copies of the same project. Most hosting services for collaborative work, such as GitHub, GitLab or Codeberg, are based on Git.
TeXmacs can be used as a complete interface to Git for your documents: you do not need to use a terminal or another program. All commands are in the Version menu, which appears automatically for documents inside a Git repository. Moreover, TeXmacs understands the structure of its documents, which makes several operations more pleasant than with general purpose tools:
differences between two versions are shown inside the typeset document, and not as lines of source code;
when you and a coauthor changed different parts of the same paragraph, TeXmacs merges both changes, word by word;
the few real conflicts are resolved in the document itself, one by one, by choosing your version or the other one;
Version\(\rightarrow\)Who changed what tells for each paragraph when it was last changed, and by whom;
commit messages can be suggested from the sections which were changed.
TeXmacs offers two ways of working. In the simple mode, you only save snapshots of your project and synchronize them with your coauthors; this is sufficient for most collaborations on a paper or a book, and requires no knowledge of Git. The full mode gives access to the usual notions of Git: staging, branches, tags, stashes and remote repositories.