Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git_ui: Show more information in the branch picker #25359

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

Angelk90
Copy link
Contributor

@Angelk90 Angelk90 commented Feb 21, 2025

Final product:

CleanShot 2025-02-26 at 9  08 17@2x

Release Notes:

  • Added more information about Git branches to the branch picker.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 21, 2025
@ConradIrwin
Copy link
Member

neat!

I'd also love it if this menu was sorted by the commit timestamp (or really ideally the reflog timestamp) so that I can quickly go back to what I was working on..

@Angelk90
Copy link
Contributor Author

@ConradIrwin : For me it is very useful to know which commit I am in, there is still no history to know the list of all the commits.

At first I did something similar #15334, but it didn't work, I hope this one will work.

If you want to make changes feel free.

@jansol
Copy link
Contributor

jansol commented Feb 22, 2025

I think I'd personally prefer if the info showed say, 5 most recent commits of the branch in git log --oneline style i.e. shortened commit hash and the first line of the commit message.

@Angelk90
Copy link
Contributor Author

@jansol : The one in the video is the select branch, which shows the most recent branches used.

What you say is that when you hover over the icon, you want them to show the 5 most recent commits of the branch you hover on?

@Angelk90
Copy link
Contributor Author

@ConradIrwin and @jansol : What do you think about something like this: #10806

@danilo-leal danilo-leal changed the title Show branch information git_ui: Show more information in the branch picker Feb 25, 2025
@danilo-leal
Copy link
Contributor

Pushed a change there revising the design a little bit, where we simplify it a lot by just showing the SHA number and the timestamp. Iterating towards a simpler, keyboard-accessible design (tooltips aren't). Maybe will explore having the beginning of the commit message in there. Here's what I pushed:

CleanShot 2025-02-24 at 10  14 19@2x

@Angelk90
Copy link
Contributor Author

Angelk90 commented Feb 25, 2025

@danilo-leal :
Some considerations:

  • Does the time that is printed refer to the last update of a file or to the last update referring to the last commit?
    From what i think it refers to the last commit, being select branch.
    But information could be misleading.
  • At the beginning I had done something similar, see: Show branch information #15334
    image
    Sometimes more than knowing what the sha of the last update or how long it hasn't been updated, I'm interested in knowing who made the last commit or the message of the last commit.
    A quick thing, without having to change panels or anything.
    These options could also be hidden if the user doesn't want via setting.json or decide what to show.
  • Something that might be interesting is an option button, see images:
    • merge, Merge into "main"...
    • rename it, Rename "name branch"...
    • to clone a specific branch, New Branch from "name branch"...
      image image

What do you think?

@danilo-leal
Copy link
Contributor

@Angelk90 regarding your first question, it's the timestamp of the last commit. And yeah, I'm considering adding the commit description, too. It just gets too cluttered, I think, but let's see!

I'm not a fan of adding more actions like that on this picker because these attached menus are not accessible via keyboard. I appreciate these are all very relevant stuff, though, so we may want to figure out a way that is not with a dropdown menu from a modal. Can you access that menu with your keyboard on this app you screenshot'ed? In any case, these are definitely for a follow up PR! This one can be simple and tight about additions within the modal items.

@Angelk90
Copy link
Contributor Author

@danilo-leal :
App is Xcode, I don't think it is accessible from the keyboard.
P.s.
Why is it convenient to be accessible from the keyboard, what is the reason?

Webstorm, what do you think of a solution like this, instead of the modal, the menu that opens on the side is accessible from the keyboard.
Above all, it does not cause problems when resizing the program.

Registrazione.schermo.2025-02-25.alle.13.35.59.mov

@danilo-leal
Copy link
Contributor

@Angelk90 that is a possible solution, yeah. We've got to explore a bit more, and maybe putting this PR out will generate some feedback for that! In my last commit, we're now also showing the last commit's message—some seem to find that unhelpful, while others appreciate the SHA. Let's see!

Keyboard navigate-ability is a major principle at Zed; we try to make most of the app accessible without a mouse for UX and speed reasons. I don't think we have 100% coverage there, but it's a goal we shoot for!

@Angelk90
Copy link
Contributor Author

@danilo-leal :

Ok, let's say I have 50 branches locally.

  • How many branches are displayed by default?

  • What do you think about putting an option in the settings to give the possibility to hide last commit's message?

Screenshot 2025-02-26 alle 09 21 34

@danilo-leal
Copy link
Contributor

@Angelk90 We currently just display the last 10 most recent branches, as per const RECENT_BRANCHES_COUNT: usize = 10;. Maybe in the future we'll want to have a way to display all branches, like any other Git GUI... unsure. But yeah, it's a valid point about putting these under a setting. Although, it also feels like unnecessary. Like, it'd be nice to settle on a great default and just let it be. I feel like what we've landed here is a good iteration and I'd probably do anything else as a follow-up.

@Angelk90
Copy link
Contributor Author

  1. Let's assume that I have 50 branches locally, and only the recent 10 are shown.
    If I search for one of the 40 branches that are not shown, if I enter the branch name in the input field, will it be found?

  2. Instead of const RECENT_BRANCHES_COUNT: usize = 10;, I would do it so that the value can be set by the user in the setting.json file, with a default of 10.

  3. I think the UI you've made is ideal for now, until we find further inspiration. I would have liked to show the username of the last commit. Some scenarios when looking at GitHub.

Registrazione.schermo.2025-02-26.alle.15.25.00.mov
Registrazione.schermo.2025-02-26.alle.15.23.42.mov

@maxdeviant
Copy link
Member

@Angelk90 We currently just display the last 10 most recent branches, as per const RECENT_BRANCHES_COUNT: usize = 10;. Maybe in the future we'll want to have a way to display all branches, like any other Git GUI... unsure. But yeah, it's a valid point about putting these under a setting. Although, it also feels like unnecessary. Like, it'd be nice to settle on a great default and just let it be. I feel like what we've landed here is a good iteration and I'd probably do anything else as a follow-up.

Agreed, don't think we need settings for it right now.

@maxdeviant
Copy link
Member

@Angelk90 You do not need to keep merging main into this branch.

It causes a GitHub notification every time and also kicks off a new CI run, which is consuming resources unnecessarily.

@Angelk90
Copy link
Contributor Author

@maxdeviant : If it's okay with you, we can merge this and the other pending PRs, there are no other changes to make at this time.

@maxdeviant
Copy link
Member

@maxdeviant : If it's okay with you, we can merge this and the other pending PRs, there are no other changes to make at this time.

It is up to @danilo-leal to decide if this PR is ready to go.

@Angelk90
Copy link
Contributor Author

@maxdeviant : Ok, you can check out the other pending PRs.

@maxdeviant
Copy link
Member

@maxdeviant : Ok, you can check out the other pending PRs.

I'm pretty sure I've said it before, but we will get to your PRs as we have time and constantly pinging myself and other maintainers about it isn't going to change that. Please stop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants