Skip to content

feat: warn before committing directly on main, master or develop - #61

Merged
YagoBorba merged 2 commits into
developfrom
feature/protected-branch-warning
Nov 25, 2026
Merged

YagoBorba merged 2 commits into
developfrom
feature/protected-branch-warning

Conversation

@YagoBorba

Copy link
Copy Markdown
Owner

Closes #30

In GitFlow, main/master and develop receive changes through pull requests.

  • CLI: stc commit detects the current branch; on a protected one it explains the problem, suggests stc git start and asks for confirmation (default no) before the wizard.
  • VS Code: the commit command shows a modal warning with Start a new branch (runs stackcode.git.start) and Commit anyway; dismissing it cancels.
  • Core: getCurrentBranch, isProtectedBranch and DEFAULT_PROTECTED_BRANCHES are exported from @stackcode/core.
  • Messages in English, Portuguese and Spanish.

Tests: core helpers against a real temporary repository (5), CLI commit flow on protected and feature branches (3 new), VS Code commit command start-branch / dismiss / commit-anyway (3 new).

Closes #30. In GitFlow those branches receive changes through pull
requests. stc commit now warns, suggests starting a branch with
stc git start and asks for confirmation (default no). The VS Code commit
command shows the same warning with Start a new branch and Commit anyway.

@stackcode/core exports getCurrentBranch, isProtectedBranch and
DEFAULT_PROTECTED_BRANCHES, tested against a real repository. Messages
are available in English, Portuguese and Spanish.
…branch-warning

# Conflicts:
#	packages/vscode-extension/src/commands/CommitCommand.ts
@YagoBorba
YagoBorba merged commit df2d16d into develop Nov 25, 2026
5 checks passed
@YagoBorba
YagoBorba deleted the feature/protected-branch-warning branch November 25, 2026 23:55
@YagoBorba YagoBorba mentioned this pull request Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant