Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 985 of the free egghead.io lessons, plus get JavaScript content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

How to update a Pull Request on GitHub

2:57 JavaScript lesson by

Once you’ve made your code updates locally, all you need to do is commit those changes and push that commit to your Pull Request branch. In this lesson we’ll also talk about how to skip git hooks that may be included in the project when you just need help.

Get the Code Now
click to level up

egghead.io comment guidelines

Avatar
egghead.io

Once you’ve made your code updates locally, all you need to do is commit those changes and push that commit to your Pull Request branch. In this lesson we’ll also talk about how to skip git hooks that may be included in the project when you just need help.

We've made our changes and we can see those by running git status. We'll see that we've modified the test file that we are supposed to increase our code coverage. We'll run git diff to see the specific test that we've added.

It's handy to check that the Travis build will continue to pass before we even push up our changes. Let's look at the configuration for Travis. We'll run some of the basic scripts to make sure that they pass locally.

We'll cat/.travis.yml, the configuration file for Travis. We'll see that there are two scripts here, npm run cover and npm run build. We can run those ourselves. Npm run cover and npm run build. If these pass, then we can feel pretty confident that our pull request will pass the Travis build.

Looks like they passed. We can continue to commit our changes. We'll say git add and git status. Make sure that everything is all set to go. Now, we'll run git commit with the message "Whatever I want." This is just going to illustrate something.

Here, it's running these git hooks but we're going to see that one git hook actually fails and we see this invalid commit message.

This is simple enough to do. If we look at the contributing guidelines, we'll see the format that is supposed to be used for these commit messages. Most projects don't have a commit message standard, but many do. It's important that you use the commit message standard that the project is using.

Look at the contributing guidelines to check whether the project that you're contributing to has a commit message format that they want you to follow. Even though this would actually be something pretty easy for us to just fix by providing a proper commit message, I'm going to illustrate how you can get around this. There are some situations where you can't figure out what's wrong and need help.

It can often be helpful to push your code so the project maintainer can give you some feedback to help you figure out what the problem is. To do this you would simply add the no-verify flag to your git command and this will skip the git hooks.

We can run git commit with the message "I need help with the commit message" and then add the flag no-verify. That will immediately commit without running any of the git hooks. Now, we'll simply push our changes to our branch with git push. If we look at our pull request -- scroll down to the bottom -- we'll see our commit message right here with that git show right there.

We'll see that Travis has started a new build and that build is in progress. We can even open the details of this build to get a sense of what Travis is actually doing for our specific PR. We can also look at the git diff and refresh to see the latest changes here. We can see that our test has indeed been added to the difference between our pull request and where we want to merge this into the master of the project.

Now, we'll wait patiently for updates from the project maintainer.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?