microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.19k stars 28.06k forks source link

git stash view #180720

Open evur opened 1 year ago

evur commented 1 year ago

Add a git stash view under the source control tab which shows a list of stashes and has buttons to apply, pop or drop on every stash in the list. There should also be a button to push staged changes to a new stash and a button delete all stashes with a confirmation dialog.

I think this would be much more usable than the current approach with menu entries.

eamodio commented 1 year ago

@evur FYI, you can install GitLens to provide a stashes view and much more.

evur commented 1 year ago

I think this feature should be in the integrated Git extension. Also, the view in GitLens is different from what I described.

eamodio commented 1 year ago

@evur Other than the "Delete All Stashes" button, what else is missing from the GL Stashes view?

evur commented 1 year ago

In my opinion, a Git stash view in the integrated extension should look a bit different. To me it looks like the GitLens version has it's own style.

For example: The number in the title bar is inside parenthesis. In the integrated extension, the number of changes is shown as a badge.

GitLens: GitLens stashes title bar

VS Code Git extension: changes badge

Another example: The files' states are shown as icons to the left of them.

GitLens: GitLens file state icons

On the other hand, they are shown as colored letters in VS Code.

VS Code: Git extension file states

This also allows showing the file type.

evur commented 1 year ago

Additionally, I would use different icons so they are more in line with the integrated extension.

eamodio commented 1 year ago

Thanks for the feedback. There isn't much I can do about the number of stashes (extensions have very limited ability for badges like that), but in the 13.6 version of GitLens (coming out tomorrow) I was able to find a way to leverage the theme icons in our views:

image

evur commented 1 year ago

This looks good. But I still think this should be part of the builtin extension. The GitLens workflow doesn't fit everyone.

wenfangdu commented 7 months ago

This looks good. But I still think this should be part of the builtin extension. The GitLens workflow doesn't fit everyone.

+1, gitlens is way too bloated for me.

lszomoru commented 5 months ago

The latest VS Code Insiders release contains a new command, "Git: View Stash..." that you can use to view a stash using the multi-file diff editor. The multi-file diff editor also contains editor title action to apply/pop (alt command), and drop the stash that is being viewed. Please give it a try and let me know what you think. Thanks!

evur commented 5 months ago

@lszomoru The view is really nice. But in addition to that, there should be a list of stashes under the "Source Control" tab. This would give the developer a nice overview. Clicking on a stash in the list should then invoke the multi-file diff editor. Like the "Changes" section, the list entries/stashes should also have buttons for apply, pop (could also be on the apply button, like the multi-file diff editor), drop and branch (git stash branch). This would complement the multi-file diff editor and enable a fast workflow for Git stashes in VS Code.

I'm looking forward to see the further development of this.

wenfangdu commented 5 months ago

@lszomoru You can also refer to https://marketplace.visualstudio.com/items?itemName=arturock.gitstash for some inspiration.

evur commented 5 months ago

@wenfangdu It can be even simpler than that with the new editor. It would just need to be a list of stashes, which show the multi-file diff editor on click and additionally have some buttons for managing them.

wenfangdu commented 5 months ago

@lszomoru I noticed the collapse button is missing from the right side, is it a bug? image

lszomoru commented 5 months ago

I would have to defer to @hediet on that one.

hediet commented 5 months ago

@lszomoru I noticed the collapse button is missing from the right side, is it a bug?

Please create a new issue. The collapse button seems to be present in your screenshot!

wenfangdu commented 5 months ago

@hediet It's only present on the left side, not on the right side, but expand shows on both sides: image

lszomoru commented 5 months ago

@hediet, @wenfangdu - filed https://github.com/microsoft/vscode/issues/203793

wenfangdu commented 3 months ago

@lszomoru git.stashView should respect diffEditor.hideUnchangedRegions.enabled and support workbench.action.compareEditor.previousChange and workbench.action.compareEditor.nextChange, a normal diff editor supports all of these. image

lszomoru commented 3 months ago

@wenfangdu, could you please file a separate issue for that? Thanks!