1

I'm learning about Git and GitHub as server. I read threads about cloning and forking differences, because their are similar.

I can clone a public repository locally, then create a new one on GitHub, and push my commits to that one. That looks as if I forked that repo.

The difference seems to be that you can only make a Pull Request to that public repo if you have forked it. That's fine.

However, for example, there are lots of public startup templates, in which (except you're collaborating to that template project), forking isn't the thing, because you're about to modify it for your own purposes, so that never going to make a pull request.

Am I missing some concept?

1

This would be about Git remotes. When you fork in GitHub, the "source" repo will be considered a remote for the new fork.

When you clone to your machine, and push back to a new GitHub repo, although the commits (and hashes for them) will be the same, GitHub will not have that "remote" relationship, which means it won’t have the relationship to send a "pull request" to.

  • so can I clone a repo and add remotes to that repo in order to pull requests to it? or should I have to fork it anyway? – whitenoisedb Mar 26 '15 at 16:25
  • If you want to make pull requests back to the original repo from your repo, then it would be fork. However, the original question suggests you wanted a clone you could pull updates from the origin with but never make a pull request back to it, in which case a fork wouldn't be necessary. Given how easy github makes this - you may as well just fork anyway now though. – Danny Staple Mar 27 '15 at 13:50
  • that was the original question, but I was wondering if once I cloned it and worked with it, if I could be still able to add remote to the original repo and pull request – whitenoisedb Mar 27 '15 at 17:16
  • You can always add other remotes and push to them. I am not sure if that will tie into the github semi-automated pull request mechanism. – Danny Staple Mar 28 '15 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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