Table of Contents
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Git
What Unryu does with a git repository: it can read one itself, in a jail, and show what changed since the last commit, who wrote each line, and what the repository's status is; and, in a repository you trust, it can run git for you: commit, revert, pull and push. This page explains the three git modes, the change bar, blame, the Tools > Git menu, and Set Up Git.
1. The git mode of a repository
The first time a file of a git repository comes in front, Unryu asks what it may do with that repository. Your answer is kept for the repository (in projects.conf), and Tools > Git changes it later.
| Mode | What Unryu does |
|---|---|
| Off | Nothing with the repository. The change bar compares each file with its text as it was opened, as outside a repository. |
| Read | Unryu reads .git itself: the last commit's text of each open file (for the change bar), the history of a file's lines (for blame), and the index (for the status). It runs no program at all, so nothing the repository names (hooks, filters, core.fsmonitor) can run. The reading is done by a process of its own in a jail, as all reading of code is (Safety): it may read the repository's folder and nothing else, and write nothing. |
| Full | As Read, and Tools > Git also runs git: Commit, Revert This File, Pull, Push, and the merge conflicts. git runs what a repository's settings name, so choose Full only for a repository you trust. Unryu asks once more when you choose Full from the menu. |
Unryu reads repositories made with SHA-1 names (nearly all of them). A repository made with SHA-256 names is read as no repository: its files' change bar compares with the text as opened.
2. The change bar
A bar at the left of the markers margin shows each line you changed: green for a line added, blue for a line changed, and a red wedge between two lines where lines were deleted. In a repository whose mode is Read or Full, it compares the text in the editor with the file in the last commit (HEAD); a file that is not in the last commit shows all of its lines as added. Elsewhere it compares with the text as the file was opened. It follows your typing, a quarter of a second after you stop.
The status bar counts the lines: +12 −3 on main (added or changed, removed, and the branch), or since opened outside a repository.
Rest the pointer on the bar, and a popup shows the lines as they were, with two links: Undo this change puts those lines back (an ordinary edit: Ctrl+Z takes it back), and Show the whole diff compares the document with the last commit's text, side by side (Comparing two texts). Navigate > Next Change and Previous Change move the cursor to the next or previous changed lines (they have no keys at first: give them some in Preferences > Keybindings).
The colors are keys of the editor theme: vcs-added, vcs-changed and vcs-deleted for the bar, and vcs-added-text, vcs-changed-text and vcs-deleted-text for the lines in its popup (Themes). The change history of Preferences > Editor > Display (changed and saved since opening) is separate, and can show beside it.
3. Tools > Git
| Item | Mode | What it does |
|---|---|---|
| This Repository: Off / Read / Full | any | The repository's mode (section 1). Greyed outside a repository. |
| Blame This Line | Read, Full | Who last changed the cursor's line, when, and the commit's first line, in the status bar and in Details (with the commit's full name). A line changed since the last commit says so. The history is read along the first parents, up to 2000 commits; a file's renames are not followed. |
| Compare with the Last Commit | any | The document compared with the change bar's base, the last commit's text (or the text as opened), as Compare > Compare with Last Commit does. |
| Status | Read, Full | The repository's changed files in Messages: changed, deleted, staged and staged new (Read: from the index, by each file's size and time, as git first looks; Full: git status --short --branch). |
| Read the Last Commit Again | Read, Full | After a commit, a pull or a change of branch made outside Unryu: the open files' last commit read again. |
| Commit... | Full | A window with a summary, details, and a check box for each changed file (all checked). Commit adds the checked files (new ones too) and commits them alone, with the message. Save your documents first: a commit takes the files as they are on disk. With more than 64 changed files, all of them are committed. |
| Revert This File... | Full | Puts the file back as the last commit has it (git checkout -- file), after saying what is thrown away: how many lines were added or changed and removed. Undo cannot bring them back. |
| Pull, Push | Full | Run in the Terminal tab, where git can ask for a password or a passphrase, or ssh-agent answers it. |
| Merge Conflicts | Full | After a pull that did not merge cleanly: the files with conflicts in Messages; each has its conflict between its <<<<<<< and >>>>>>> lines. |
| Set Up Git... | any | Section 4. |
4. Set Up Git
Tools > Git > Set Up Git... shows what git needs and what is missing, and makes only what you choose:
- Who commits: your name and email (
git config --global user.nameanduser.email). A commit needs both; the window says when one is missing. Only a changed field is written. - SSH key: whether you have one in
~/.ssh, and a check box to make an ed25519 key. The key is made in the Terminal tab, sossh-keygencan ask you for a passphrase there; then it shows the public key. When you have a key, Details shows its public line to give a server (its SSH keys settings), to push without a password. - Repository: whether the project (or the file's folder) is a repository, a check box to make one there (
git init), and its remoteorigin, which you can set or change. - Signing: a check box to sign your commits with the SSH key (
gpg.format ssh,user.signingkey,commit.gpgsign).
The status bar says how many changes were made, and whether any failed.