GNU TeXmacsUser manualReferenceAboutEnglish
Getting started with Git
Requirements

The Git program must be installed on your computer; TeXmacs uses it for all operations. If it is not found, you may indicate where it is in Version\(\rightarrow\)Git preferences. Git also needs to know your name and e-mail address, which are recorded in each commit. If you never configured them, then type once in a terminal

git config --global user.name "Your Name"
git config --global user.email "you@example.org"

For exchanging changes with a server, Git must be able to connect without asking for a password in a terminal: use an SSH key with an SSH agent, or a credential helper (see the documentation of your hosting service).

The Version menu

By default, the Version menu is shown for all documents which belong to a Git or Subversion working tree. You may show it for all documents, or never, using Tools\(\rightarrow\)Versioning tool.

Putting a document under version control

If the current document does not belong to a repository yet, then Tools\(\rightarrow\)Versioning tool\(\rightarrow\)Create Git repository creates a new repository in the directory of the document (the same entry is in the Version menu, when it is shown). All files in this directory and its subdirectories may then be put under version control. A file .gitignore is created as well, which tells Git to ignore the backup files of TeXmacs.

If your coauthors already have a repository on a server, then use Tools\(\rightarrow\)Versioning tool\(\rightarrow\)Clone Git repository (or Version\(\rightarrow\)Clone Git repository). In the dialog, enter the address of the repository, as given by the hosting service, and the directory in which the copy should be made. The copy is made in the background, after which the status of the new working tree is shown. The repositories you worked with recently are listed in Version\(\rightarrow\)Recent Git repositories.

Using Git in an existing folder

The configuration of a repository may instruct Git to run arbitrary programs, even when TeXmacs only asks for the status of a file. For this reason, TeXmacs only runs Git in the repositories which you created or cloned with TeXmacs, and in those which you explicitly trust. When you open a document inside another repository, for instance one which you cloned in a terminal, the Version menu only contains Version\(\rightarrow\)Use Git in this folder, besides the tools for comparing files. Choose it if you know where the repository comes from; the complete menu then becomes available. Only do this for folders whose origin you trust, such as your own projects: do not do it for an archive you received by e-mail.

Choosing a mode

The first time you open the Git panel, TeXmacs asks you how you want to work:

Simple

Save snapshots and synchronize with coauthors. The details of Git remain hidden. See the simple mode.

Full

Staging, branches and remotes, for users who know Git.

Until you choose, the full mode is used. You may change your choice at any time in Version\(\rightarrow\)Git preferences.

Overview of the interface

For a document in a repository, the Version menu is organized as follows:

The footer at the bottom of the window also shows the state of the repository, for instance

Git main · 2 changes · ↑1

This means that you are on the branch main, that two files were changed or added since the last commit, and that one commit is waiting to be sent to the server. Similarly, ↓2 means that two commits of your coauthors are waiting to be received. The footer shows saved when there are no changes, the number of conflicts during a merge, and working… while Git is running in the background.

The Git panel

Version\(\rightarrow\)Git panel opens a panel on the right of the window, which shows the state of the repository of the current document and stays up to date while you work. At the top, you find the current branch, the number of commits ahead and behind, and buttons for getting and sending changes (or for synchronizing, in the simple mode). The panel has three tabs:

Changes

The changed files, grouped into conflicts, staged changes, other changes and new files (in the simple mode, only conflicts and changes), with buttons for staging, comparing and resolving them. Below, a box for a message, with Suggest, which describes the changes, and Commit (or Save snapshot). Each repository keeps its own message.

History

The recent versions of the current document, each of which can be compared with the current one or restored.

Branches

The branches of the repository, with buttons for switching to another branch or creating a new one.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".