Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub fork a repo from previous commit

Tags:

github

I've found a repository on GitHub I would like to fork - but not the current version.

I want to fork the repo as it was quite a few commits back - is this possible? The repo has not marked any releases, so I'm not sure how to do this. I could obviously copy the code as it was in that commit, but I would prefer to fork, as then I get the link back to the original repo.

like image 644
ACarter Avatar asked Oct 06 '13 20:10

ACarter


1 Answers

You can only fork the current repository.

You can reset the forked repository's master branch to an earlier commit though, making it look like as if you had forked it at that point.

See: How can I rollback a github repository to a specific commit?

If you reset every branch, it effectively resets your repository to an earlier state of the original repository (with exception of branch-independent data, like configuration, hooks etc which is not reset). Since it's possible that not all branches contain the commit from the master branch, you might need to look up commits by date for each branch, to reset them to the last commit before the commit from which you want to fork.

like image 53
kapex Avatar answered Sep 28 '22 17:09

kapex