Skip to content

feat: add 'reset to custom ref' option in git reset menu#5401

Open
Mentigen wants to merge 1 commit intojesseduffield:masterfrom
Mentigen:feat/reset-to-custom-ref
Open

feat: add 'reset to custom ref' option in git reset menu#5401
Mentigen wants to merge 1 commit intojesseduffield:masterfrom
Mentigen:feat/reset-to-custom-ref

Conversation

@Mentigen
Copy link

@Mentigen Mentigen commented Mar 20, 2026

Summary

Closes #1985

Adds a new "Reset to custom ref" option (key c) to the git reset menu, allowing users to reset to any arbitrary ref without leaving lazygit.

Behavior:

  1. Press g (reset menu) on a branch, commit, tag, or remote branch
  2. Press c → a prompt appears with autocomplete suggestions (local branches, remote branches, tags, HEAD, FETCH_HEAD, etc.)
  3. After confirming the ref → the standard soft/mixed/hard selection menu appears for that ref

Changes:

  • Added suggestionsHelper field to RefsHelper (injected via constructor) so the reset menu can use ref autocomplete
  • Added "Reset to custom ref" menu item with key c to CreateGitResetMenu in refs_helper.go
  • Added ResetToCustomRef and EnterRefToResetTo i18n strings in english.go
  • Swapped creation order of refsHelper / suggestionsHelper in controllers.go (no functional change, required by the new dependency)

Test plan

  • Open any branch/commit/tag reset menu (g)
  • Press c, verify prompt appears with ref autocomplete
  • Type a partial ref name, verify suggestions filter correctly
  • Confirm a ref, verify soft/mixed/hard menu appears titled "Reset to <entered-ref>"
  • Confirm reset, verify git reset --<mode> <ref> runs correctly

Adds a new menu item (key 'c') to the git reset menu that prompts the
user to enter an arbitrary ref to reset to. The prompt includes
autocomplete suggestions from all known refs (local branches, remote
branches, tags, HEAD, etc.). After confirming the ref, the standard
soft/mixed/hard type selection menu is shown.

Closes jesseduffield#1985
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.

Allow reset to custom branch

1 participant