Github / EGit pull request workflow - eclipse

Say I have a repo and someone forks it. Then they do work and submit a pull request. But the code contains a large number of lines and/or it creates a GUI. I'd like to fetch it so I can actually see it run from Eclipse before merging it into my master. The options I've come up with are:
Create a second repo in EGit and clone directly from their fork.
Create a new branch just for them. Then leave a comment for the request asking them to re-submit the pull request using the new branch and that I'll be closing the current request (without merging)
Always keep around a branch for them to use in their pull requests.
Besides setting up an organization on Github what else could I do?

Then leave a comment for the request asking them to re-submit the pull request using the new branch and that I'll be closing the current request
They don't have to re-submit, it you test and merge first locally, as described in the "Merging a pull request" GitHub page.
git checkout master
git pull https://github.com/otheruser/repo.git branchname
If the local merge works, then you can go ahead and merge the pull request through the GitHub web interface.
GitHub has documented how to checkout a pull request.
As I have illustrated before in "What support for git namespaces exists in git hosting services", you can use refs/pull/<PRNumber>/head as remote pull reference, in command line or in Egit when, for instance, creating a new branch.

If the PR number is 123, you can simply use the EGit Pull action, and use pulls/123/head as reference.

Related

Pull request to freeCodeCamp guide - how to proceed

I wanted to contribute to the FCC guides and I actually did.
This is my fork to the repository
Link: https://github.com/BitYog/guides
However, when I open the main guides repository, I don't see my changes being shown anywhere. What do I do so that my changes are merged and committed into the main repo?
You don't see your commits in the original repository, because you didn't create a pull request against that repository, but against your fork. In other words, you opened a pull request to merge BitYog/guides#BitYog-patch-1 into BitYog/guides#master. With that, you updated your own master branch, but not that of freeCodeCamp/guides.
Your changes will only show up when a pull request into freeCodeCamp/guides#master is merged. For that to happen, you need to open a new pull request in the freeCodeCamp repository and request to merge either your master or BitYog-patch-1 branch into master.

How do I make a pull request using EGit?

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?
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.
On GitHub, navigate to the repository's page and click the Fork button in the top-right corner of the page
Copy the URL of the forked repository to create a local clone in EGit
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.
Make one or more commits that should end up in a pull request.
Push these changes to the forked repository.
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 = git#github.com:your-name/forked-repo.git
fetch = +refs/heads/*:refs/remotes/fork/*
[remote "origin"]
url = git#github.com:user/originating-repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
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.
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.
Go to the repository on github.com.
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.
If From Eclipse you commit the changes but due to conflict you cant get the Pull Request so do following steps to get pull req from git bash command
git status
git checkout develop-robot
git log [check your commit present or not]
git pull
git checkout
git rebase develop-robot
git push -u -f origin

Github : Fork with pull requests

I am working on this code : https://github.com/samvermette/SVPullToRefresh
This have many pull request pending. But due to some reason Author is not able to accept.
So I decide to Fork project and accept some of the request which can improve code.
But when I fork project I don't get all that Pull request in Forked copy.
Is there any way to get that all pull request in my forked copy?
I Get this question which is very similar : Fork a Pull request, on Github
But I am not able to know how to do it. I am not able to find how to write "unit tests".
I get some answer which require to get local copy on my computer and than work with some git commands. But I think there should some way to do it on web interface only. Tell me if I am getting wrong.
You won't be to see the PR from the original "upstream" repo in your fork, but you still can import them in your local clone:
git remote add upstream /url/of/original/repo
git config remote.origin.fetch "+refs/pull/*/head:refs/remotes/upstream/pr/*"
(The pull/ID branch naming convention is mentioned in the GitHub help page "Modifying an inactive pull request locally")
That way, you can merge any upstream/pr/<ID> branch you want in your local repo.

GitHub - how to submit individual pull request in case of multiple commits

I've made multiple commits to my local repository and now I intend to do pull request to submit these changes over to the source/master.
When I do a pull request, it automatically includes all of my commits. I couldn't locate a way to submit each commit in its own pull request. Could someone please give some pointer on how to do this on GitHub.
Update
To clarify on this question, I forked a new local repo from upstream/master. Then, in my noobie-ness, I made new files in my local master itself without branching repo out first. So, effectively, my question is with these changes committed to local master repo, is there a way to raise pull requests for each new file one by one, and not for all of them in one go.
Many Thanks.
I'm not sure if there is a better way in GitHub, but in general, you can create a new branch for each pull request, cherry-picking the commits you want for each request.
The new branches should preferably be based on upstream master to make the merge painless.
Using command line git, using origin as your own github remote repo, upstream is the upstream remote:
git checkout -b {my_pull_request_feature_branch} upstream/master
git cherry-pick {sha1_of_first_commit_for_feature_X} [sha1_of_another_commit_for_feature_X] ...
git push origin {my_pull_request_feature_branch}
Repeat for each pull request.
When you do a pull request on GitHub you can then choose which branch you want to send in your request.
A commit does not stand on its own, it always links to the full previous history. So if you ask to pull commit B which depends on your commit A, then you are also asking to pull A, because your work in B depends on it.
If you want to submit multiple independent pull requests, you should make sure that those commits are completely independent of each other. So they should be on their own branches. This also makes it easier for the project maintainers to integrate your pull request, as they can just merge the branch without having to cherry-pick stuff.

in github, can I clone/merge branch online?

I want to clone/merge branch for my git repository inside github, for example merge updates in draft branch to gh-pages for publish.
And in some cases, I don't have access to command line for git command.
Is it possible to achieve this online ?
You can merge branches in GitHub using a Pull Request as long as the merge doesn't create any conflicts.
To merge a pull request on GitHub:
Create a Pull Request to merge the draft branch into the
gh-pages branch.
If it can be merged online, you'll see This pull request can be automatically merged. and a Merge pull
request button.
Click the button and you'll have a chance to Cancel the merge or add a commit message and Confirm Merge.
If you choose to Confirm Merge, the Pull Request will automatically close.
For more information, visit Github's Merging a Pull Request Help page.