Could not switch to branch sdods/checkout: Command failed: git checkout -B sdods/checkout
That is the whole message. Nothing applied, which I am glad about, but git's own reason is nowhere — not on stdout, not with --json. Am I supposed to guess?
You are not, but you do have to ask git yourself. accept runs the checkout with its output discarded and only wraps the exit status, so the message you get is the shape of the failure and not the cause of it. Run the same command by hand and git will tell you:
bash
git checkout -B sdods/checkout
The causes I have actually seen, in the order they turn up:
the directory is not a git repository at all. Far and away the most common one — a project folder
that was copied rather than cloned, and nobody noticed because nothing else in SDODS cares.
the branch is checked out in another worktree: `fatal: 'sdods/checkout' is already checked out
at '...'`.
a name git will not take as a ref.
a half-finished merge with unresolved paths in the index.
Note that a dirty tree is not on that list. -B creates or resets the branch at the commit you are already on, so nothing in your working tree moves and uncommitted changes come along with you.
The proposal is untouched by a failed accept, so nothing was lost either way. You can also skip the flag entirely — switch yourself, then accept onto whatever branch you are standing on:
Since you are looking at that flag anyway, know what it does when it succeeds: the checkout is -B, so a branch of that name that already exists is reset to where you are standing now. It will not refuse and it will not warn you.
Which is fine for a throwaway review branch and quietly awful if you reuse one branch for several proposals and had commits on it.
We name branches after the proposal id rather than the topic — --branch sdods/<id> — precisely so nothing is ever reused. Ugly branch names, nothing lost.