Skip to content

feat: checkout branch/revision with picker#506

Open
gotschmarcel wants to merge 1 commit intoaltsem:masterfrom
gotschmarcel:feature/checkout_branch_picker
Open

feat: checkout branch/revision with picker#506
gotschmarcel wants to merge 1 commit intoaltsem:masterfrom
gotschmarcel:feature/checkout_branch_picker

Conversation

@gotschmarcel
Copy link

@gotschmarcel gotschmarcel commented Feb 1, 2026

Screenshot 2026-02-01 at 23 40 12

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

  • ✅ The modified code has some test-coverage (where applicable).
  • make test is passing (this is what CI runs).
  • ✅ New unreleased features/fixes/styling and performance improvements are documented via git: feat: / fix: / style: / perf:. Or e.g. perf(highlighting):.
    See https://github.com/altsem/gitu/blob/master/docs/dev-tooling.md

Copy link
Owner

@altsem altsem left a comment

Choose a reason for hiding this comment

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

Edit: wrong PR. I'll be back soon :)

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.
@altsem altsem force-pushed the feature/checkout_branch_picker branch from c4f9ef4 to 954ba97 Compare February 6, 2026 16:04
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);
Copy link
Owner

Choose a reason for hiding this comment

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

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.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I saw that. If the other PR is merged, I can probably make use of that function.

Copy link
Owner

Choose a reason for hiding this comment

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

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();
Copy link
Owner

Choose a reason for hiding this comment

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

True, it should close down everything when aborted.
(it currently does not in master: mm<esc> - leaves the menu open).

Copy link
Author

Choose a reason for hiding this comment

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

If you want I can make an extra commit to fix this as the first commit on this PR

Copy link
Owner

Choose a reason for hiding this comment

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

Sounds good!

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.

2 participants