Getting Started with Git

Aug 14 2023 · git 2.28, console

Part 1: Getting Started with Git

06. Create a Pull Request

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 05. Merge Changes Next episode: 07. Resolve Conflicts

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 06. Create a Pull Request

No prior experience is required.

Transcript: 06. Create a Pull Request

So far you’ve created a branch and pulled those changes in locally and pushed those changes to the remote repository. This can work if you’re just developing on your own, and you are the only collaborator. But if you want to work with others, you’ll want to create a pull request.

Pull requests allow you to discuss your changes with your team and make follow-up commits to your branch before your changes are merged into the base branch.

In the GitHub app, create a new branch like you did in the previous video called “fried-chicken-recipe” by going to branch, new branch. Then give the branch a name titled “fried-chicken-recipe”. Create a new text file called fried-chicken.txt. In it, you can put any make-believe recipe you want. I’ll copy and paste one in myself.

Once you put in your recipe, switch back to the GitHub app. Commit that change and write a description for your commit. Write, “Added delicious fried chicken recipe.”

In order to create a pull request, we need to publish the branch first. Click publish branch. Once that’s done, click preview pull request.

This shows that we are creating a merge commit into the main branch from our current branch, fried-chicken-recipe. These are the changes that will be added to that commit.

Click create pull request. This opens a web browser to the recipes-book repo with the preview we just saw. We are opening a pull request from fried-chicken-recipe to the main branch.

In this section, this is where you can write a longer description for your changes. Often times, if you’re working on a large software project, you’d want to describe the changes you made, why you made the change, maybe a ticket number if you work with a tool like Jira, and sometimes even a screenshot or a video of the feature you built.

GitHub’s description field also supports Markdown, so you can leverage that if you’re familiar with Markdown to give a more visually appealing description. If you aren’t familiar with Markdown, it’s something easy you can search for to get the basic syntax down.

Write, pound, fried chicken recipe ticket, followed by, added new recipe for fried chicken.

Once you’re done with the description, select “Create pull request.” At this point, the pull request is ready for someone else on your team to review.

We can pretend we are another reviewer at this point so we don’t have to sign into another GitHub account.

Go to “Files changed.” This is where you can see each of the changed files, and you can write comments to the original author. Currently, my view may look different than yours. If so, you can change your view of the files here at the gear icon.

I prefer the “Split” view. In this view, it shows the original file on the left and changes on the right.

If we were really reviewing these changes, we could add a comment like, “Did you think about adding the temperature of the oil, the type of oil, or the termpature of the chicken when it’s done?” Even as the author, you can comment on your own code to explain a particularly tricky section of code.

Go back to “Conversation.” Once you and your reviewer iron out anything in your pull request, which could include pushing additional changes to your branch like adding more test coverage for example, you’re able to merge your pull request. Select “Merge pull request.”

Go back to the GitHub app. Now this change is merged into the main branch. Switch the branch to main. View the history. Our changes aren’t there yet because as you remember, you need to fetch those changes and pull them in.