Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a specific revision of a github gist?

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.

Except deleting the Gist, is there a way to delete that particular revision definitely?

I saw that I'm not the only one having that kind of problem (Git: delete a single remote revision) but I didn't manage to remove the revision. The process indicated here seems to help remove some files. I want to remove the whole revision.

like image 332
Cyril N. Avatar asked May 06 '11 13:05

Cyril N.


People also ask

Can you edit a GitHub gist?

How Do I Edit or Delete a Gist? In the top right corner of your gist page, there will be a menu that allows for multiple functions to be performed on your gist. We can edit, delete, unsubscribe, star, embed, copy, share, and download a raw copy or zipped copy of a gist. We also can share a gist in multiple ways.

Can you delete a GitHub gist?

Drag the Delete Gist action under Github to the canvas, place the pointer on the action, and then click or double-click the action. The Delete Gist window opens. 2. Edit the Label, if needed.

Can you delete a gist?

Anonymous gists cannot be removed.

How do I delete something from GitHub?

Browse to the directory in your repository that you want to delete. In the top-right corner, click , then click Delete directory. Review the files you will delete. At the bottom of the page, type a short, meaningful commit message that describes the change you made to the file.


1 Answers

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 <commit> is the commit you want to "remove", do

 git rebase -i <commit>^ 

mark the line for <commit> as edit, save and quit.

git will set up the working directory to the state after you comitted <commit>. 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).

like image 67
Tilman Vogel Avatar answered Sep 29 '22 01:09

Tilman Vogel