Skip to content

[feat]: Make the random branch suffix optional #1936

Closed

Description

@arthurficialS

Feature Summary

A per-project setting in .emdash.json to make the random 5-character branch suffix optional, so teams whose convention is one ticket ID → one branch name can use clean names like ZN-6671 instead of ZN-6671-aj3jg.

Problem or Use Case

Task branches always get a 5-character random suffix appended (e.g., ZN-6671-aj3jg). For teams that follow strict ticket-to-branch naming conventions (JIRA, Shortcut, Plane, etc.), this breaks the convention and requires a manual rename before every push.

We name tasks after JIRA ticket IDs (ZN-6671) so the branch matches the ticket. Our CI auto-links PRs, runs status checks, and routes deploys based on the ticket-key prefix in the branch name. The current suffix breaks all of these unless we manually rename before each push.

The suffix is hardcoded — there's no setting in .emdash.json or the UI:

src/main/core/tasks/operations/createTask.ts:46:

const suffix = Math.random().toString(36).slice(2, 7);

src/main/core/tasks/resolveTaskBranchName.ts:

return branchPrefix ? \`\${branchPrefix}/\${rawBranch}-\${suffix}\` : \`\${rawBranch}-\${suffix}\`;

The only existing escape is the Linear-linked-issue path (linkedIssue?.provider === 'linear'), which doesn't help users on JIRA, Shortcut, Plane, or other trackers.

Proposed Solution

A per-project setting in .emdash.json:

Option A — boolean, simplest:

{ "branchSuffix": false }

Option B — mode, preserves the existing uniqueness safety net:

{ "branchSuffix": "always" | "on-conflict" | "never" }

"on-conflict" would only append a suffix if the desired branch name already exists locally, so duplicate task names still don't clobber each other but the common case stays clean.

I'd advocate for Option B with "always" as the default for full backward compatibility.

Touchpoints in code:

  • src/main/core/settings/schema.ts — new optional field on the project settings schema
  • src/main/core/tasks/resolveTaskBranchName.ts — consume the new setting
  • src/main/core/tasks/operations/createTask.ts:46 — suffix generation becomes conditional
  • src/main/core/tasks/operations/renameTask.ts — same logic applies to renames

Alternatives Considered

Manual rename before push:

git branch -m ZN-6671-aj3jg ZN-6671
git push -u origin ZN-6671

Functional but doesn't scale across many tasks and developers.

A custom workspaceProvider script could replace emdash's worktree creation entirely, but that means reimplementing port assignment and integration logic for what is ultimately a cosmetic concern.

Additional Context

Happy to put up a PR if the maintainers are open to the direction.

Activity

  1. changed the title [-]Make the random branch suffix optional[/-] [+][feat]: Make the random branch suffix optional[/+] on May 8, 2026
  2. arnestrickmann commented on May 8, 2026

    @arnestrickmann
    Contributor

    @arthurficialS
    Thanks for raising this issue. A setting like this could make a lot of sense. Will keep you in the loop here on timeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions