code icon indicating copy to clipboard operation
code copied to clipboard

Add Git reset to changed file context menu

Open cassidyjames opened this issue 6 years ago • 5 comments

It would be super handy to be able to reset a file to its state according to Git. I think the sane place would be its context menu in the project sidebar. But now I also wonder if there's overlap with the "Restore this file" item in the headerbar?

cassidyjames avatar May 13 '19 19:05 cassidyjames

I'll look into this tackling this issue, since I've been toying around with libgit2 for some other stuff.

If there are no objections, I'd like to move all the libgit2 code in ProjectFolderItem into a GitProjectManager or ProjectGitManager (open to other names, depending on your preferences) since its currently a violation of separation of concerns. Ideally all libgit2 calls should be made within GitProjectManager, to centralize all the obtuse libgit2 code.

ChristopherNugent avatar Aug 20 '19 07:08 ChristopherNugent

I believe @davidmhewitt did most of that work, I'd be curious to hear his thoughts!

cassidyjames avatar Aug 20 '19 18:08 cassidyjames

I'm happy to implement it in whichever way the maintainers prefer.

ChristopherNugent avatar Aug 21 '19 06:08 ChristopherNugent

@ChristopherNugent Have you made any progress on this?

jeremypw avatar Nov 25 '19 19:11 jeremypw

"Restore this file" only resets changes to the file made since it was opened. It is possible that Code was opened and closed more than once and edits made to a file in multiple sessions, in which case this function would not restore the file according to Git.

jeremypw avatar Feb 11 '21 16:02 jeremypw