Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to fork a repository multiple times to make multiple pull requests?

I want to work with another programmer on a project using git on bitbucket. Since I am not the owner of the project, I did the following steps:

  1. I forked the project (I have of on my repo now)
  2. I made my changes and commited them
  3. I pushed to my repo
  4. I made a pull request

The owner of the project accepted my pull request and all the changes are now in his repo.

Now, I want to make a new pull request of the modified version of the project owner. Should I make a new fork of the same repo?


The forumulation of the problem with some codes:

  1. I forked the project (I have a copy on my repo now)

    • owner/proj: the repo of the owner
    • me/proj: my fork of the owner/proj
  2. I made my changes and commited them

    git add .

    git commit -m "fork-commit"

  3. I pushed to my repo

    git push -u origin # the push was done into my repo: me/proj

  4. I made a pull request & it is accepted by the owner (the master branch of me/proj and owner/proj are identical)

  5. After that the owner did some extra changes to his master branch of owner/proj, the repos situation is as follows:

    • the master branch of me/proj is exactly the same of the master branch of my local repo. Consequently, the command git fetch and git pull will do nothing (that's normal)
    • the master branch of me/proj and the master branch of owner/proj are different.

SO TO AVOID MULTIPLE FORK, should I make a git pull on the owner repo? Or should we (me and the owner) share the same repo?

Thanks,

like image 785
Amine Jallouli Avatar asked Aug 27 '15 17:08

Amine Jallouli


People also ask

Can I fork a repository twice?

You are unable to fork a repo twice on Github (as of late 2021) but if you want to build on the same repo multiple times, you can use the "Import Repository" option and feed it the URL used to clone.

Is fork necessary for pull request?

If you don't have access to create branches on that repository, there is no way to create a pull request without forking.

Can I create a pull request from a forked repo?

You can create a pull request to propose changes you've made to a fork of an upstream repository. Anyone with write access to a repository can create a pull request from a user-owned fork.

Can I create multiple pull requests?

There can be only one open PR from a given branch.


1 Answers

SO TO AVOID MULTIPLE FORK, should I make a git pull on the owner repo? Or should we (me and the owner) share the same repo?

No need for multiple forks, just make a git pull from the owner repo.

Always use pull requests for untrusted contributors. If it's ok with the owner, you should try different workflows and find one that both of you are comfortable with.

like image 198
joran Avatar answered Oct 08 '22 04:10

joran