---
title: git
description: The site's branches, commits, diffs and merges, on this connection's
  checkout.
sidebar:
  order: 25
---

The site's branches, commits, diffs and merges, on this connection's checkout. Typed inside `bash`, where `help git` prints the same.

```text
Usage: git <verb> [<arguments>]

The site's files are a git repository, and this connection keeps one
checkout of it per site: a branch, a directory and the changes not
committed yet. Its first call on a site starts on main, which is what
visitors see. Work on a branch, commit there, and put the branch live
with merge_branch.

  git status [-s]                     the branch, its commit and the changes not committed
  git diff [--stat|--name-only|--name-status] [<a> [<b>]] [-- <paths>]
                                      no ref (or HEAD): the changes not committed; one:
                                      that ref against HEAD; two, or <a>..<b>: those two;
                                      <a>...<b>: what <b> changed since the two parted
  git switch <branch>                 move the checkout to a branch (or git checkout <branch>)
  git switch -c <branch> [<from>]     start a branch at HEAD or <from> and move to it
                                      (or git checkout -b)
  git branch [-v]                     list the branches, * on the checkout's own
  git branch <branch> [<from>]        start a branch without moving to it
  git branch -d <branch>              delete a branch (never main, never the checkout's own)
  git add [<paths>]                   does nothing: every change is staged already
  git commit -m <message>             commit every change on the branch, checked first
  git log [--oneline] [-n <N>] [<ref>] [-- <paths>]
  git show [<ref>]                    a commit's message and changes
  git show <ref>:<path>               a file's text at a branch or a commit
  git restore [--source <ref>] <paths>
                                      drop changes not committed (git restore . drops them
                                      all), or take the files as <ref> has them
  git checkout [<ref>] -- <paths>     the same as git restore
  git pull                            bring HEAD up to the branch, keeping the changes
  git rebase main                     replay the branch's commits on top of main
  git rebase --continue               after a conflict: each conflicting file as the
                                      checkout reads it is its resolution
  git merge <branch> [-m <message>]   bring a branch's changes into this one as one commit
  git revert <commit> [-- <paths>]    put files (all, without paths) back as a commit had
                                      them, as one new commit
  git rev-parse [--short|--abbrev-ref] <ref>

A ref is a branch, main, HEAD, a commit id (its first seven
characters are enough), or any of them followed by ~<N> or ^.

A commit puts each .vzk file in canonical form and says which lines
that changed. Changes not committed are kept for 7 idle days and
while the connection stays signed in. Nothing is pushed: merge_branch
puts a branch live, and main is never written or merged into here.
```
