How do I make a pull request using EGit?

13,026

Solution 1

These are the steps necessary to fork a repository, make changes and finally open a pull request to have the changes merged back into the originating repository.

  1. On GitHub, navigate to the repository's page and click the Fork button in the top-right corner of the page

  2. Copy the URL of the forked repository to create a local clone in EGit

  3. I recommend creating a new branch in the form your-name/issue-name. Working on a separate branch gives a better oversight and helps when working on multiple pull requests in parallel.

  4. Make one or more commits that should end up in a pull request.

  5. Push these changes to the forked repository.

  6. On GitHub, navigate to the fork's page. You should see a message there indicating that a new branch was created and a button to create a pull request. Click this button. On the next page, you can provide more information and finally confirm the creation of the pull request.

In order to consume changes made to the originating repository, you would want to add it as a remote to your local clone.

You may even want to rename the remotes, so that the forked repository (the one you are pushing to) is named fork and for the originating repository use the default name origin.

For example:

[remote "fork"]
  url = [email protected]:your-name/forked-repo.git
  fetch = +refs/heads/*:refs/remotes/fork/*
[remote "origin"]
  url = [email protected]:user/originating-repo.git
  fetch = +refs/heads/*:refs/remotes/origin/*

Solution 2

In this answer, I assume that you have commit rights on the project in question, but still want to create a pull request. In this case, it's not necessary to fork the repository.

  1. Create a local branch in Eclipse (Team -> Switch to -> New branch..., use the default values) and work on it. Eventually, push the branch to the GitHub repository.
  2. Go to the repository on github.com.
  3. GitHub will usually recognize that you have pushed a branch and offers the option to create a pull request directly. Alternatively, you should be able to create a pull request from the "pull requests" tab.
Share:
13,026
Daniel Paczuski Bak
Author by

Daniel Paczuski Bak

Updated on June 29, 2022

Comments

  • Daniel Paczuski Bak
    Daniel Paczuski Bak almost 2 years

    I have a local master branch and I want to create a pull request with a repo owned by somebody else. When I attempt to "push branch", I get the following text: "can't connect to any URL: https://github.com/jleclanche/fireplace: git-receive-pack not permitted"

    I'm guessing that what I'm doing here is actually trying to merge, rather than making a request. How would I do this?