Search code examples
gitgithubpull-requestgit-fork

How can I create a pull request from a fork without having created a branch on the fork?


I created a fork on Github, worked on the fork and now I want to create pull request for the original project to take my changes.

All the documentation I can find here, GitHub and Google refers to a branch being selected for the pull request, but I did not create one.

How can I proceed?


Solution

  • A branch in git is just a pointer to a specific commit, nothing more.

    When you fork a repo you take a copy of it and suddently you've two master branches. Our master branch, and the one in the forked repo.

    Hence, you don't need to create a new branch. Let's say you forked the project foobar, did a commit to the master branch and then do a pull request. Github will descibe this as robs_fork:master -> foobar:master