How to update a Pull Request on GitHub

Kent C. Dodds
InstructorKent C. Dodds
Share this video with your friends

Social Share Links

Send Tweet
Published 8 years ago
Updated 5 years ago

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.

[00:00] 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.

[00:13] 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.

[00:24] 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.

[00:46] 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.

[01:04] 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.

[01:11] 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.

[01:25] 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.

[01:44] 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.

[01:57] 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.

[02:25] 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.

[02:54] Now, we'll wait patiently for updates from the project maintainer.

Angelo Varlotta
Angelo Varlotta
~ 5 years ago

Hi guys, has anyone tryed GitHub Pull Requests for VSCode?

Markdown supported.
Become a member to join the discussionEnroll Today