Let's say you want to clone an old (GitHub) repository A into your own repository B. However, you don't need any branches nor do you want the very long commit history. What you want is a shallow clone as a snapshot of the most current status of the repo. Preferably with the latest commit messages, only, while still showing from what point in A
it was forked from. This is graphically shown in GitHubs Insights > Network
tab, as arrows going from one users repo to another.
The problem is that of the solutions I've tried to so far, all end up making a gap in the GitHub Network
graph. This is probably because they all rely on either removing/restoring .git
or force pushing which seem to cause the GitHub UI to disconnect the clone/fork, and instead it end up looking like this:
I'm not sure how to best phrase this question as there are already several dozens that sound very similar if not the same, while none of them seem to address this issue, if it is even possible.
So the question is:
How can I keep the forks dependency in GitHubs Network
graph, while still having removed most of the commit history?
(I understand that I can't remove the whole history and still have something connected in the graph, but shouldn't it be possible to squash the fork in such a way that all commits in A
is turned into one squashed commit (as seen from the fork), while all new ones in B
are normal?)
I've looked at these answers, but they were not of much help:
- How to handle big repositories with Git - looked promising but didn't have any details
- How do I update a GitHub forked repository?
- Sync a fork of a repository to keep it up-to-date with the upstream repository.
- How can I keep my fork in sync without adding a separate remote?