How does an owner of a repo do a pull request?

Viewed 1180

I have used GitHub as a contributor, but never as an owner. Recently, I created a repo to work with a friend as the repo's collaborator. As the owner of my repo, I can push to the repo. However, I am really confused about how to fo a pull request as the owner of the repo???

Today, I pushed a new file to that repo, but the collaborator can't see it. I tried to do a pull request, but GitHub says nothing to compare to. I couldn't find info saying whether an owner of a repo needs to do a fork in order to do a pull request. And from the post, Git - Creating pull request without forking, a response said "there are only two ways that allow you to create pull requests: Either from a fork or when you have contributor access to the original repository."

My question: (1) Can a repo owner do a pull request from the repo's main branch or needs to create a branch first? (If The owner needs to create a branch beforehand, I did it, but my collaborator can't see my newly pushed file. As mentioned above, I couldn't do a pull request from the branch I created) (2) I am not completely sure whether a repo owner needs to fork his own repo in order to do a pull request. Even though it looks redundant to me, can you tell me this is also a right way to do a pull request?

1 Answers

Usually repo owner does not need to fork repo and makes a feature branch off the main branch directly in the repo and then creates pull request between main branch and their feature branch.

If that somehow breaks workflow (e.g. when owner doesn't want to pollute branch list or there's a branch creation policy that restricts feature branches in main repo) and repo owner should fork first then I would recommend moving repo under a separate project organization which makes things same for owner (in terms of their personal profile) as for other contributors.

To resolve your issue, this is obvious but still - after making changes did you push branch with commits back to Github (git push -u origin your-feature-branch)? In such case it should show in Github branch selector on your repository and you should be able to make pull request from it.

Related