j0h
j0h

Reputation: 1784

how do I fork an older version of a github project?

how do I fork an older version of a github project? I want to fork on a specific commit of a project, commit 3b5915a21a997f88fa16a6feb5b893953a06b0b5 of this

project: https://github.com/aseprite/aseprite, where a recent commit broke the main line. I really want to fork fork version 1.1.8.

Upvotes: 15

Views: 13114

Answers (3)

Pranav Kumar
Pranav Kumar

Reputation: 354

A small update to the preferred answer:

As of Aug 13th 2021, GitHub is moving away from password based authentication to Token based authentication.

Prior to the last step of the procedure, you can create a token on your profile: https://github.com/settings/tokens

With this token, you can force push your changes to git, as long as you have configured your username and email to your git account. If not you can do with these on your terminal:

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

Upvotes: 1

MTarantini
MTarantini

Reputation: 999

I had to do the same with aws-sdk-go recently since they stopped supporting Go 1.4, yet AWS had my Preconfigured Docker configuration locked at Go 1.4 and unable to upgrade to Go 1.5.

  1. Fork the repo.
  2. Clone it locally: git clone [email protected]:__________
  3. Find the commit you want to go back to.
  4. Reset to that commit's SHA: git reset __________
  5. Get rid of changes: git add && git stash
  6. Push removal of changes to repo: git push --force

With that I was good to go to import the new repo that wouldn't break my application. Woohoo!

Upvotes: 19

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137398

  1. Fork the entire project. This is the only way.

  2. Create a new branch off of that commit.

    $ git checkout -b my-branch 3b5915a21a

  3. Commit changes to your branch.

  4. Push the changes to your forked repository.

  5. Submit a Pull Request back to the original project.

Upvotes: 16

Related Questions