12

After working through this Github tutorial I'm more confused than when I started. I thought forking a repo would essentially create a copy of the repo with some other user-specified name. Then I can commit to the new repo without thinking about the repo from which I forked.

Unfortunately this doesn't seem to be the case. I browsed to one of my own repos (this may be a problem) and clicked "Fork" on Github. Nothing happened. I completed the tutorial but nothing seems to have changed. Editing/committing/pushing still goes to the original repo.

2
  • 2
    I don't think you can fork your own repository, can you? Just other peoples'.
    – Ry-
    Nov 26, 2011 at 0:50
  • You can't fork your own repository. This is entirely used for contribution. Aug 12, 2014 at 21:21

2 Answers 2

28

You fork somebody else's repo:

At some point you may find yourself wanting to contribute to someone else’s project, or would like to use someone’s project as the starting point for your own. This is known as “forking.”

It creates a copy of the repository, with all its history, for you, to which you can commit. Try forking the Spoon-Knife project as suggested in the tutorial.

The fork-and-pull model of open-source development allows anybody to start making changes without initially confronting or requesting permission from the project owners.

You can then send pull requests from your forked repo to the original repo, if you wish to contribute back.

3
  • Also, if you want to make some changes that you will send back as pull-requests, I believe it is better to work on a different branch first, do not work on the master branch.
    – ustun
    Nov 26, 2011 at 9:13
  • "You can then send pull requests from your forked repo to the original repo" - You mean from the original repo you can request a pull that moves files from the forked repo to the original, right? If you did that from the forked repo, wouldn't that be a push? Mar 25, 2014 at 17:38
  • 2
    @VictorEngel No, you are making a request to the upstream (original) repo's owner to pull the changes from your forked repo. You are asking: "Can you pull in my changes please?"
    – David Hu
    Mar 26, 2014 at 3:24
3
  1. You have to fork foreign repo, to which you haven't commit access, in order to get your repo with full rights
  2. You have to create local clone of forked repo for work with it

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.