You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes in a PR file changes slip in that you didn't intend. Maybe you didn't correctly stash, a commit hook made a formatting change, or some other thing happened.
The ultimate result is that you want to undo changes to a particular file in your PR. It'd be nice to have a button on the header of every file in the diff to revert that change.
Something like this...
It seems like this was added in #1398, but it's no longer present or working now. At least not in the FF version of the plugin. GitHub added the trashcan icon to actually delete a file... heh, I almost did that >_>.
“Delete file” fully deletes the files, it’s a feature that was added by GitHub.
“Revert all changes in file” is a feature that would indeed be nice to have, arguably this is the only button PRs need 👍
Reacted by Justin Bennett, Connor Love, Sindre Sorhus, Jeroen van Warmerdam, Ahia Elster, Dmitriy Krasnikov, Briggs Elsperger, Sam Araiza, Aniruddh, Gianni Gabriel and 7 more
GitHub's api doesn't really expose higher level git actions like checkout. We could use the commit api to try to replicate this process, but I'm not sure how to go about doing that.
Activity
fregante commentedon Apr 1, 2019
They’re different.
“Delete file” fully deletes the files, it’s a feature that was added by GitHub.
“Revert all changes in file” is a feature that would indeed be nice to have, arguably this is the only button PRs need 👍
[-]Add (or restore) button to remove file from PR[/-][+]Remove file from PR[/+]hardikmodha commentedon Apr 2, 2019
@bfred-it I would be more than happy to contribute to this. Can you point me towards the starting point? Thanks!
fregante commentedon Apr 2, 2019
Honestly I don’t know if there’s an easy way to do this, you’d have to look the API for reverting
just-be-dev commentedon Apr 2, 2019
Yeahhh... I was looking into this. It's definitely non-trivial.
I think the easiest way to is to follow this path:
fregante commentedon Apr 3, 2019
checkoutthe file like you can in git: https://stackoverflow.com/questions/215718/reset-or-revert-a-specific-file-to-a-specific-revision-using-gitjust-be-dev commentedon Apr 3, 2019
GitHub's api doesn't really expose higher level git actions like checkout. We could use the commit api to try to replicate this process, but I'm not sure how to go about doing that.
fregante commentedon Apr 4, 2019
The correct API seems to be Contents API
https://developer.github.com/v3/repos/contents/#update-a-file
Use it for steps 2 and 3
issuehunt-oss commentedon Jun 24, 2019
@issuehunt has funded $80.00 to this issue.
issuehunt-oss commentedon Aug 11, 2019
@sindresorhus has rewarded $72.00 to @fregante. See it on IssueHunt