Creating a pull request

To create a pull request, you have to go on your GitHub account and make it directly from your forked account; but first, you have to know that pull requests can be made only from separated branches. At this point of the book, you are probably used to creating a new branch for a new feature or refactor purpose, so this is nothing new, isn't it?

To make an attempt, let's create a local TeaSpoon branch in our repository, commit a new file, and push it to our GitHub account:

[6] ~/Spoon-Knife (master)
$ git branch TeaSpoon

[7] ~/Spoon-Knife (master)
$ git checkout TeaSpoon
Switched to branch 'TeaSpoon'

[8] ~/Spoon-Knife (TeaSpoon)
$ vi TeaSpoon.md

[9] ~/Spoon-Knife (TeaSpoon)
$ git add TeaSpoon.md

[10] ~/Spoon-Knife (TeaSpoon)
$ git commit -m "Add a TeaSpoon to the cutlery"
[TeaSpoon 62a99c9] Add a TeaSpoon to the cutlery
1 file changed, 2 insertions(+)
 create mode 100644 TeaSpoon.md

[11] ~/Spoon-Knife (TeaSpoon)
$ git push origin TeaSpoon
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 417 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/fsantacroce/Spoon-Knife.git
   d0dd1f6..62a99c9  TeaSpoon -> TeaSpoon
  

If you take a look at your account, you will find a surprise: in your Spoon-Knife repository, there is now a New pull request button made for the purpose of starting a pull request, as you can see in the following screenshot:

Clicking that button makes GitHub open a new page; you now have to select the branch you want to compare to the original repository; look at the following screenshot:

Go to the branches combo (1), select TeaSpoon branch (2), and then GitHub will show you something similar to the following screenshot:

This is a report, where you can see what you are going to propose: a commit containing a new file.

But let me analyze the page.

In the top left corner of the preceding screenshot, you will find what branches GitHub is about to compare for you; take a look at details in the following image:

This means that you are about to compare your local TeaSpoon branch with the original master branch of the octocat user. At the end of the page, you can see all the different details (files added, removed, changed, and so on):

Now, you can click on the green Create pull request button; the window in the following screenshot will appear:

In the central part of the page, you can describe the work you did in your branch. A green Able to merge text on the top left informs you that these two branches can be automatically merged (there are no unresolved conflicts; that is always good if you want to see your work considered).

And now the last step: click the Create pull request button to send your request to the original author, letting him get your work and analyze it before accepting the pull request.

At this point, a new conversation begins, where you and the project collaborators can start to discuss your work; during this period, you and other collaborators can change the code to better fit common needs, until an original repository collaborator decides to accept your request or discard it, closing the pull request.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.121.131