feat: checkout branch/revision with picker#506
Open
gotschmarcel wants to merge 1 commit intoaltsem:masterfrom
Open
feat: checkout branch/revision with picker#506gotschmarcel wants to merge 1 commit intoaltsem:masterfrom
gotschmarcel wants to merge 1 commit intoaltsem:masterfrom
Conversation
53bc045 to
c4f9ef4
Compare
This was referenced Feb 3, 2026
altsem
approved these changes
Feb 6, 2026
The checkout action shows an interactive picker to select a branch to checkout using fuzzy matching. Checking out a custom revision not found in the branch list, e.g. a commit hash, is also possible. If the checkout is started from a previously selected revision, e.g. by selecting one in Show Refs or from the recent commits section, the revision is put at the top, allowing users to continue by just hitting <enter> like before.
c4f9ef4 to
954ba97
Compare
altsem
requested changes
Feb 6, 2026
| checkout(app, term, &rev)?; | ||
| Ok(()) | ||
| // Allow custom input to support checking out other revisions not in the list | ||
| let picker = PickerState::new("Checkout", branches, true); |
Owner
There was a problem hiding this comment.
There's similar logic in src/ops/merge.rs now from the other usage of the Picker.
To me, I think these two should probably behave exactly the same. So perhaps let's settle on one behaviour of listing revs, and re-use that.
Author
There was a problem hiding this comment.
Yes, I saw that. If the other PR is merged, I can probably make use of that function.
Owner
There was a problem hiding this comment.
I merged it in yesterday finally! :)
Comment on lines
+71
to
+73
| // TODO: necessary to make sure parent menu closes, shouldn't this be | ||
| // handled by .picker, like .prompt does? | ||
| app.close_menu(); |
Owner
There was a problem hiding this comment.
True, it should close down everything when aborted.
(it currently does not in master: mm<esc> - leaves the menu open).
Author
There was a problem hiding this comment.
If you want I can make an extra commit to fix this as the first commit on this PR
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.
The checkout action shows an interactive picker to select a branch to checkout using fuzzy matching.
Checking out a custom revision not found in the branch list, e.g. a commit hash, is also possible.
If the checkout is started from a previously selected revision, e.g. by selecting one in Show Refs or from the recent commits section, the revision is put at the top, allowing users to continue by just hitting
<enter>like before.There's one TODO in the code where I'd appreciate some feedback. I'm happy to make changes to the code.
Checklist
make testis passing (this is what CI runs).feat:/fix:/style:/perf:. Or e.g.perf(highlighting):.See https://github.com/altsem/gitu/blob/master/docs/dev-tooling.md