0

Is it possible to submit a pull request if I originally cloned a repo locally rather than using the GitHub "fork" functionality??

The scenario is that I have created a local clone of a repository and made some changes. I would like to submit these back via pull request. I can create a repo on GitHub and push my changes there. Once I do that, will I be able to use the "new pull request" functionality, or will GitHub be unable to recognise that the repo is equivalent to a fork?

  • 3
    see Where does my tool question go? – gnat Mar 17 '17 at 10:55
  • Why not fork and then push the changes? Creating a separate repository just wastes your (and GitHub) bandwidth as well as (probably) storage space (forking could use hard links) – Daniel Jour Mar 17 '17 at 19:01
2

It doesn't matter when you create the fork because of the distributed nature of git, but github needs a fork in order to make the association necessary to create a pull request, and it also lets people searching your profile more easily make the association back to the original project. Without the fork, you break a lot of very helpful links.

In my local workspace, I usually like to set up one remote called upstream to more easily pull from the original, then have origin point to my fork. After you create a fork, you can use the instructions here to change your origin remote url, then just push to there like normal. That way you won't lose any of your existing history.

  • cat ~/bin/hub-fork: hub fork $*; git remote rename origin up && git remote rename $USER origin; git remote -v – rurban Mar 18 '17 at 6:47
  • This isn't 100% accurate - Even GitHub's own UI states that you can "Compare and review just about anything", when you create a new pull request. – ryanwebjackson Jan 13 '18 at 17:02

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.