Add restore deleted branches and their upstreams - #5887
Open
borngraced wants to merge 10 commits into
Open
Conversation
Restore an upstream branch that was deleted on the remote by pushing the local branch back to its configured upstream, removing the '(upstream gone)' state.
borngraced
force-pushed
the
restore-deleted-branch
branch
from
August 3, 2026 12:09
c7d50d9 to
e3cab97
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Please check if the PR fulfills these requirements
go generate ./...)Adds two related capabilities for recovering branches that no longer show up in the branch list:
lazygitare now detected via thereflogand listed in the branch panel with a "deleted branch" badge. A new keybinding (<ctrl+r>in the branches panel) opens a menu to recreate the selected deleted branch at its last commit. If exactly one matching remote-tracking ref survives, the upstream is re-attached automatically.(upstream gone)", a new "Restore upstream branch" item in the upstream options menu(u → p)pushes the local branch back to its configured remote, recreating the branch and clearing the gone state.Includes unit tests for deleted-branch detection (with hardening against reflog noise like SHA-like refs and orphaned checkout entries) plus integration tests covering both the delete-and-restore flow and the upstream-gone restore.