I'm getting started with a project with a friend on Github. So far, he has created the repository and I have forked it. I started making changes to my repository, committed, and pushed the changes to origin (my forked copy).
We're now ready to integrate the changes into his original repo.
What is the difference between the Fork Queue and a Pull Request?
Do I need to send a pull request? Can he simply accept the changes in the fork queue and be done with it?
Thanks in advance!
Ethan
The pull request is about reviewving and accepting commits explicitly send by other forked project back to your project.
The Fork Queue is about reviewing commits present in all the forked projects, but not yet present in your project. No explicit request has been made by those other forked projects for you to accept said commits: this is just you being curious about what others are doing based on your initial work.
In your case, a pull request is recommended, and will result in a review and a merge, and many more features.
Related
To be clear: I am NOT asking how to keep my fork up-to-date. I am asking a very different question, and the answer seems to be independent of GitLab or Github.
I'm curious as to why my fork doesn't need to be kept up-to-date? I have forked a project, and I have a local clone of the project with two remotes ("thetango", my fork, and "upstream", the main project). I have noticed that I don't ever really need to update my fork on either GitLab or GitHub.
I would have thought that when I pushed to create a PR (GitHub) or an MR (GitLab) the first error I would have received is that my fork is out-of-date and needs to be fast-forwarded. That never happens, which confuses me.
What git magic does GitLab and Github implement so that my fork doesn't need to be updated? Am I misunderstanding what a fork is?
When you create a pull request between your fork of a repository and a branch in the main repository, you're essentially proposing a merge between a given branch in your repository and a given branch in the main repository. The only branches which matter in that case are those two.
You may have other branches in your fork, such as the default branch and branches that include other work you're doing, but unless you're doing a pull request with one of them, how far ahead or behind they are from their corresponding branches in the main repository is irrelevant.
Now, if the branch you're creating a pull request from is far behind the one you want to merge into in the main repository, then the chance of merge conflicts increases. Therefore, it's prudent to keep your local repository up to date with the main repository if you're going to be creating pull requests, so that when you push that branch to make a PR, the branch you push is not substantially out of date.
One reason you may choose to keep your fork's main branch up to date is if you're doing independent development. For example, Git for Windows contains many Windows-specific patches which have not made it into mainline Git, so their repository is kept up to date because it's essentially an entire separate line of development.
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.
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.
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.
I've forked a repo on github to do my own customistations.
However, along the way, I discovered a bug and fixed it and would like to send a pull request upstream.
I followed the guide at:
http://gun.io/blog/how-to-github-fork-branch-and-pull-request/
And have created a branch with just the bugfix on it - but when I go to submit a pull request to the upstream - it lists all the changes I've made since I forked, I can't seem to find a way to isolate the bug fix patch.
I don't want to send all my changes, and I'm guessing they don't want to receive them - so how do I send just the bug fix?
If it helps, the repo is
https://github.com/chrisjensen/ankusa
The branch is untrainfix
The way pull requests work is to apply a commit from a fork on top of the upstream repo.
For that, the easiest way is to make your fix on the same branch than the one you intend to apply it (by making a pull request) on the upstream repo.
In other words, all your changes should be done in a custom branch, except for the fix, that you should do (or report by cherry-picking) on the same branch than the one used in the original upstream repo.
If you want to fix a bug on master from upstream, make your fix in the master branch of your fork, by first making sure your master branch is identical (git pull) to the one in upstream.