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 Answer 1

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.

4
  • 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? Commented Mar 26, 2015 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. Commented Mar 27, 2015 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 Commented Mar 27, 2015 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. Commented Mar 28, 2015 at 10:55

Your Answer

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

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