What's the purpose of forking a git repo?
Solution 1
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.
Solution 2
- You have to fork foreign repo, to which you haven't commit access, in order to get your repo with full rights
- You have to create local clone of forked repo for work with it
Comments
-
SundayMonday almost 2 years
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.
-
Claudio Pierard over 12 yearsAlso, 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.
-
Victor Engel about 10 years"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?
-
David Hu about 10 years@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?"
-
Victor Engel about 10 years@David, thanks for the clarification. That makes sense.