skip to Main Content

I am using VS Code to edit files that are part of a Git project. In VS Code’s Timeline view, I can see one line for each previous commit of the selected file. For example:

screenshot of Timeline view

Each line includes the commit message of the corresponding commit, and that’s helpful. But I want more: I want each line to start with the first characters of the Git hash (AKA "commit ID"). For example, I want each line to start with 661259, 76fb07, and so on, if those are the first characters of the relevant hashes. Is there a way to add this info to Timeline view?

I’ve Googled and looked through Stack Overflow, but I haven’t found any clear answers to this question.

Edit 2023-09-13: I’ve opened a feature request to add this capability to Timeline view. See https://github.com/microsoft/vscode/issues/192959. Please upvote the request if you would like to see the feature added to VS Code; if it isn’t upvoted, the request will soon be closed.

2

Answers


  1. I’m not aware of there being a feature to enable display of commit hashes with git-related timeline entries. You can right click such entries, and you’ll get a menu with an option to "Copy Commit ID". You can also use the filter to filter for only "Git History" entries.

    I’d expect that if it were togglable, there’d be a setting with the prefix git.timeline., but under settings with that prefix or just the prefix timeline., there are no such settings.

    I’m also not aware of how an extension could do this. Extension can contribute menu items to the context menu for timeline entries (see timeline/item/context), but I don’t think they can add action buttons / decorations to the timeline entries themselves.

    A feature request has been raised: Show commit hashes in Timeline view #192959. Given that, if you’d like such a feature, I’d suggest you open a feature request. If you do, please comment here with a link to it, or edit the link into this answer post.

    Login or Signup to reply.
  2. I recommend a extention on VS Code for you. That’s all you need. GitLens

    Example:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search