Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I know this is a silly hypothetical but say I forked it and then gutted the fork and built my own unrelated project in the repo. GitHub would delete my project that contains zero offending material?


yes. (afaik github forks of a repo really all point to the same repo internally)


This is only true if you use the fork button. You can easily create a new repo, clone the old repo, and push to the new repo. GitHub will not show a fork relationship between the two.


true, I assumed that from the question, because otherwise it wouldn't be a fork in any way if the history has been deleted.


Even if the history is exactly the same, GitHub only tracks forks made through the fork button. A true git fork (eg anonymous clone, push to brand new repo, preserving all commit history) is not tracked.


... yes, that's what you already said?


Based on your comment I thought you only thought it applied when you deleted the history, just wanted to clarify.


I think he just means to create the repo like normal and push your fork there as opposed to creating a fork using the fork button.


Your hypothetical project would not contain zero offending material. It's all still in the .git/ folder, in various forms that can be recovered.


Github’s “fork relationship” is not stored in .git/ in any way.


No, but the github server is configured as remote for anything checked out from Github. And I don't know how the remote will handle a merge (push) from a repo with rewritten history.


It could not be "recovered" by git in any way.


I was under the impression that you could 'rewrite' history if you wanted by amending, squashing, and removing commits? Or does some of the artifacts still live on?


Until Git garbage collects, it's all still there (mostly). Sure there are some extraordinarily destructive things like `rm .git/` that you could do, but even if you point a new repo at remote it might not accept the merge (push).


Even with a force push that zeros history?


I'm not really sure. Try it, then take a look at reflog and see what's still referenced. Check the size of the .git/ directory as well - is it smaller? There are some ways to rewrite history in git, but until git GCs I believe that they are mostly non-destructive.

I'm sure that you could rm the .git/ and overwrite it but keep it pointing at the same repo. I don't know what would happen on the remote, though, when you push.


Nope. If you remove the history too, then the content is gone.

For good measure, you should also probably run a `git gc` (garbage collect) on the repo too, just to be sure. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: