Skip to content

Conversation

stefanhaller
Copy link
Collaborator

I find the command "Checkout previous branch" quite useful, and I use it a lot. However, I'm unhappy with the visual feedback, so this PR improves that a bit.

Previously, the feedback you got when pressing "-" was just a "Checking out..." status in the bottom line. This was both easy to miss if you are used to looking for an inline status in the branches panel, and it didn't provide information about which branch was being checked out, which can be annoying in very large repos where checking out takes a while, and you only see at the end if you are now on the right branch.

Improve this by trying to figure out which branch was the previously checked out one, and then checking it out normally so that you get an inline status next to it (as if you had pressed space on it). There are cases where this fails, e.g. when the previously checked out ref was a detached head, in which case we fall back to the previous behavior.

Previously, the feedback you got when pressing "-" was just a "Checking out..."
status in the bottom line. This was both easy to miss if you are used to looking
for an inline status in the branches panel, and it didn't provide information
about which branch was being checked out, which can be annoying in very large
repos where checking out takes a while, and you only see at the end if you are
now on the right branch.

Improve this by trying to figure out which branch was the previously checked out
one, and then checking it out normally so that you get an inline status next to
it (as if you had pressed space on it). There are cases where this fails, e.g.
when the previously checked out ref was a detached head, in which case we fall
back to the previous behavior.
@stefanhaller stefanhaller added the enhancement New feature or request label Oct 2, 2025
@stefanhaller
Copy link
Collaborator Author

Ping @kyu08 in case you want to have a look.

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for ba0e2d11 83.33%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ba0e2d1) Report Missing Report Missing Report Missing
Head commit (e585acc) 57756 50209 86.93%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4929) 18 15 83.33%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@kyu08
Copy link
Contributor

kyu08 commented Oct 3, 2025

Thank you for letting me know!
I will test it later. 👍

Copy link
Contributor

@kyu08 kyu08 left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this!

I tried this with large repo and it looks clearer than as is. 👍

For the users who want to see what's changed visually, I put a screenshot.

CleanShot 2025-10-03 at 13 57 28@2x

@stefanhaller stefanhaller merged commit 7544de0 into master Oct 5, 2025
14 checks passed
@stefanhaller stefanhaller deleted the better-feedback-for-check-out-previous-branch branch October 5, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants