Skip to content

Checkouts and remotes

These commands continue in ~/field-notes from the tutorial.

Checkouts

$ forest checkout current
survey
$ forest checkout create scratch
Created checkout 'scratch'.
$ forest checkout list
* scratch
  survey
$ forest checkout survey
Switched to checkout 'survey'.
$ forest checkout remove scratch --yes
Removed checkout 'scratch'.

forest checkout NAME switches to NAME and creates it first if it does not exist. checkout create also switches to the new checkout. Every checkout has its own stages and bindings, and by default pushes under <remote>/<checkout>/.

Remotes

Remotes belong to the workspace. remote use picks the remote for checkouts created after it runs. A checkout keeps the remote it started with.

$ forest remote add backup ~/backup-remote
Added remote 'backup' -> ~/backup-remote
$ forest remote use backup
Remote for new checkouts set to 'backup'.
$ forest remote list
  backup    ~/backup-remote [local]
* origin    ~/forest-remote [local]
$ forest checkout create scratch
Created checkout 'scratch'.
$ forest add raw ./data/raw
Added stage 'raw' -> data/raw
$ forest push raw/plot-01
Transferred: 36 B, 2 files
PUSH raw/plot-01  2 files, 36 B -> backup
$ forest checkout survey
Switched to checkout 'survey'.
$ forest push raw/plot-01
SKIP raw/plot-01  already synced to origin

remote list stars the active checkout's remote. scratch pushes to backup, and survey still uses origin. You can't remove a remote while a checkout uses it:

$ forest remote remove origin
Error: Remote 'origin' is the saved source of checkout 'survey'; it cannot be removed.

remote add also takes S3 and SFTP options (--region, --endpoint, --profile, --key-file, --known-hosts). See the CLI reference.