unison/unison-src/transcripts/switch-command.md
2024-06-25 11:11:07 -07:00

1006 B

The switch command switches to an existing project or branch.

foo/main> builtins.merge
bar/main> builtins.merge

Setup stuff.

someterm = 18
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).

scratch/main> switch foo
scratch/main> 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.

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