unison/unison-src/transcripts/switch-command.md

986 B

The switch command switches to an existing project or branch.

.> builtins.merge

Setup stuff.

someterm = 18
.> project.create-empty foo
.> project.create-empty bar
foo/main> add
foo/main> branch bar
foo/main> branch topic

Now, the demo. When unambiguous, switch switches to either a project or a branch in the current project. A branch in the current project can be preceded by a forward slash (which makes it unambiguous). A project can be followed by a forward slash (which makes it unambiguous).

.> switch foo
.> switch foo/topic
foo/main> switch topic
foo/main> switch /topic
foo/main> switch bar/

It's an error to try to switch to something ambiguous.

foo/main> switch bar

It's an error to try to switch to something that doesn't exist, of course.

.> switch foo/no-such-branch
.> switch no-such-project
foo/main> switch no-such-project-or-branch