How to delete a specific revision of a github gist?

后端 未结 5 1969
时光取名叫无心
时光取名叫无心 2020-12-23 09:51

I created a Gist on GitHub and I saw informations I don\'t want anyone to see. I updated the file since, but everybody can still access the old revision of the file.

5条回答
  •  醉酒成梦
    2020-12-23 10:15

    Github has a help page about removing sensitive data:

    http://help.github.com/removing-sensitive-data/

    As gists are just git repositories, you should be able to locally clone your gist, do the clean-up there and do a forced push to overwrite the github version with the cleaned repo.

    Yes, after thinking about it: If is the commit you want to "remove", do

     git rebase -i ^
    

    mark the line for as edit, save and quit.

    git will set up the working directory to the state after you comitted . Fix the file, use git add and git commit --amend to fix the commit. Then do git rebase --continue. If the only thing, the next commit did, was to remove the sensitive data, it will probably be automatically dropped because it doesn't contain any changes after the now-amended commit.

    Then, do a git push -f to force the update (because it is now non-fast-forward, meaning it changes already published git history).

提交回复
热议问题