If you delete a public git repository, and then replace it with a different one, can that cause complications?
Background: A while ago, I branched a project and made a few commits, which have either been pulled in or have become irrelevant (but the latest commit of my fork isn’t an ancestor of the main repository). I’d like to delete my fork so that I don’t get any irrelevant pull requests on github.
The concern I have is that if I delete my fork, and then create a new fork based on the main repository, could that cause the same kinds of problems as doing a git rebase on a public repository?
The complications will indeed be similar to those with rebasing a public branch. The new master branch will point to a commit which does not have the old one as an ancestor, so everyone will be unable to pull. (Branches will probably also appear or disappear, but that’s not as big a deal.)
So, I’d say there are two main options:
Clobber your branch with a merge. Short version: use
--strategy=oursto merge your (old) master into the main repo’s master. Long version: see here or here. This gets you the content of the main repo’s master, but keeps your history moving forward in the normal way. The main reason you wouldn’t do this is if you really don’t want those commits in the history (perhaps because they make the repo a lot larger) – if that’s the case, move on to option two…If it really needs to happen, suck it up and do it. Notify people what’s going on, get past it, and all will be good.