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

Extend gitsigns.diffthis for diff between index and HEAD #698

Open
dasupradyumna opened this issue Dec 25, 2022 · 7 comments
Open

Extend gitsigns.diffthis for diff between index and HEAD #698

dasupradyumna opened this issue Dec 25, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@dasupradyumna
Copy link

dasupradyumna commented Dec 25, 2022

Hello Lewis!
Thank you for a such a simple yet convenient plugin!

Is your feature request related to a problem? Please describe.

I often use gitsigns.diffthis to compare current working tree to the index, and in my workflow, I usually stage my changes / hunks incrementally (parts of a feature, for example) as I work on a feature, before committing. As such, I use git diff --cached HEAD <file> for this purpose (I got used to this feature while using VS Code long back).

One thing I had checked was -

  • Open the index for a file using show function.
  • Tried to execute diffthis HEAD on the index file, but there was no change / no diff was opened.

Describe the solution you'd like

I am assuming there is a check which disallows diffthis to work on index buffers, so I was wondering if it is possible to modify diffthis function to work when the active buffer is the git index of a file.

Please let me know if this feature already is doable with the current plugin (probably something I missed), otherwise I do think this is a valuable addition to an already amazing plugin.

Additional context

I am hoping for something like this ; except the right side pane should be the git index of the file and not the file from the working tree.

featreq_gitsigns_diffthis

@dasupradyumna dasupradyumna added the enhancement New feature or request label Dec 25, 2022
@dasupradyumna
Copy link
Author

Hey @lewis6991,
I hope you're not busy. May I get a response? :)

@lewis6991
Copy link
Owner

This isn't possible at the moment but I plan to add diffthis support for any Gitsigns buffer.

@dasupradyumna
Copy link
Author

So after you add that support, I can open the index for a file using show and run diffthis HEAD on the index buffer to get a git-diff between index and HEAD. Did I understand you correctly?

@danielo515

This comment was marked as resolved.

@lewis6991

This comment was marked as resolved.

@danielo515

This comment was marked as resolved.

@lewis6991

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants