Reputation: 3451
I'm wondering from a security perspective, if I have a branch in Git that I later delete. In that branch, if I have code that only happened in that branch and, in that branch I had commits that removed it. Then, I delete that branch on GitHub, is that deleted code somehow still in the GitHub Repo?
Seems to me that there is not history in Git, and no way to get back to that branch since it's deleted, but not sure it's really gone.
Upvotes: 2
Views: 786
Reputation: 6409
A branch is just a pointer to a commit in the repository. When you delete a branch, it only deletes that pointer. It is possible to recover the branch and commits later on, so if you need certain files or data completely removed, then you will need to modify the commit history.
There are several ways to do this without completely losing your history.
https://rtyley.github.io/bfg-repo-cleaner/
"The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:
Removing Crazy Big Files Removing Passwords, Credentials & other Private data The git-filter-branch command is enormously powerful and can do things that the BFG can't - but the BFG is much better for the tasks above, because:
Faster : 10 - 720x faster Simpler : The BFG isn't particularily clever, but is focused on making the above tasks easy Beautiful : If you need to, you can use the beautiful Scala language to customise the BFG. Which has got to be better than Bash scripting at least some of the time." - BFG documentation
https://git-scm.com/docs/git-filter-branch
"Lets you rewrite Git revision history by rewriting the branches mentioned in the <rev-list options>, applying custom filters on each revision. Those filters can modify each tree (e.g. removing a file or running a perl rewrite on all files) or information about each commit. Otherwise, all information (including original commit times or merge information) will be preserved." - git documentation
https://help.github.com/en/github/site-policy/github-sensitive-data-removal-policy
I don't think this is really what you are looking for, but it does give you options just in case.
"We provide our sensitive data removal process to remove this sensitive data in certain exceptional circumstances where the DMCA process would not be applicable, such as when your security is at risk from exposed passwords and you do not own the copyright to the specific content that you need removed, or the content is not protectable by copyright." - GitHub documentation
Upvotes: 2
Reputation: 30242
To the best of my knowledge, github does not delete stuff from their repos.... however, there is a process you can go through to ask them to delete something like a branch so the objects are disposed of.
https://help.github.com/en/github/site-policy/github-sensitive-data-removal-policy
Upvotes: 1