Skip to content

Add "Signed-off-by" trailer option to commit options menu#21741

Merged
niik merged 3 commits intodevelopmentfrom
copilot/enable-signoff-for-commits
Mar 10, 2026
Merged

Add "Signed-off-by" trailer option to commit options menu#21741
niik merged 3 commits intodevelopmentfrom
copilot/enable-signoff-for-commits

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

Many open source projects require Developer Certificate of Origin (DCO) sign-off on commits. GitHub Desktop had no way to add Signed-off-by trailers without amending via CLI or manually inserting the line.

Description

Adds a "Add Signed-off-by trailer" toggle to the commit options (gear) menu. When enabled for a repository, commits are passed --signoff, appending Signed-off-by: Name <email> from the user's git identity. The option is per-repository and resets on app restart (matching the skipCommitHooks behavior and git's own stance on not supporting a config option for this).

  • app-state.ts: Added signOffCommits: boolean to IRepositoryState; expanded CommitOptions to Pick<IRepositoryState, 'skipCommitHooks' | 'signOffCommits'>
  • repository-state-cache.ts: Default signOffCommits: false
  • commit.ts: Added signOff?: boolean to createCommit options → appends --signoff to git args
  • app-store.ts: Passes signOff: state.signOffCommits into createCommit
  • commit-message.tsx: Added signOffCommits prop; new checkbox menu item in commit options context menu; removed isCommitOptionsButtonEnabled (was gated on hasCommitHooks) — the button is now always rendered since the sign-off option is always available; the "Bypass Commit hooks" menu item is conditionally shown only when enableHooksEnvironment() && hasCommitHooks; gear icon loses default-options styling when either option is active
  • All intermediate components (sidebar.tsx, repository.tsx, filter-changes-list.tsx, app.tsx, commit-message-dialog.tsx) updated to propagate the new prop

Screenshots

Commit options menu with the new toggle:

Release notes

Notes: [Added] Add option to include a Signed-off-by trailer on commits for Developer Certificate of Origin workflows

Original prompt

This section details on the original issue you should resolve

<issue_title>Enabling --signoff / -s on commits</issue_title>
<issue_description>Please describe the problem you think should be solved

A lot of open source projects work with the Developer Certificate of Origin (like Linux, Nextcloud and others). Currently, commits created with GitHub Desktop can not be signed off and you would have to amend each one using the command line. Or you have to manually insert the Signed-off-by: … line in every commit.

Do you have any potential solutions in mind?

Possible solutions are:

  1. Simply sign off every commit automatically. The only thing to add to the commit message is:
Signed-off-by: Name <mail@example.com>
  1. Or if automatic signing has any drawback, have a global (or per-project) setting on whether commits should be signed automatically.</issue_description>

<agent_instructions>The recent work to add support for hooks added a commit options button to the commit message area (commit-message.tsx L1028-1037). Clicking this opens a context menu that lets the user toggle whether to include hooks or not. This would be a good place to add a "Add Signed-off-by trailer" menu item which would cause subsequent calls to git commit for that repository to be called with --signoff.

Given that Git has decided against allowing a config option to always add --signoff (https://git-scm.com/docs/gitfaq#Documentation/gitfaq.txt-Whynothavecommitsignoffandotherconfigurationvariables) we should make this option per-repository and NOT persisted across restarts.

Implementation wise it should be able to follow the implementation of the skipCommitHooks option (i.e. added to IRepositoryState and CommitOptions types in app-state.ts).</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@sergiou87 Another request for this in https://github.com//issues/19205

Custom agent used: deskocat
Takes an unstructured issue or idea and produces a planned, tested, risk-assessed implementation with a well-documented PR


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: niik <634063+niik@users.noreply.github.com>
Copilot AI changed the title [WIP] Enable --signoff option for commits in GitHub Desktop Add "Signed-off-by" trailer option to commit options menu Mar 5, 2026
Copilot finished work on behalf of niik March 5, 2026 13:52

private get isCommitOptionsButtonEnabled() {
return enableHooksEnvironment() && this.props.hasCommitHooks
return enableHooksEnvironment()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot This would always be enabled now right? We could just remove the isCommitOptionsButtonEnabled but we have to conditionalize whether the "Bypass commit hooks" context menu item is visible depending on whether enableHooksEnvironment is true AND hasCommitHooks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 75fd4cd. Removed isCommitOptionsButtonEnabled entirely (and the now-redundant isActionBarEnabled getter). The button is rendered unconditionally, and the "Bypass Commit hooks" item is now conditionally pushed into the menu array only when enableHooksEnvironment() && this.props.hasCommitHooks.

…show button unconditionally, conditionalize Bypass Commit Hooks menu item on hooks environment and hasCommitHooks

Co-authored-by: niik <634063+niik@users.noreply.github.com>
Copilot finished work on behalf of niik March 5, 2026 14:06
@niik niik marked this pull request as ready for review March 6, 2026 14:26
@niik niik merged commit a7d9314 into development Mar 10, 2026
21 checks passed
@niik niik deleted the copilot/enable-signoff-for-commits branch March 10, 2026 13:46
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.

Enabling --signoff / -s on commits

3 participants