How to update a GitHub pull request (PR)

So what happens when you submit a PR, but then you want to change it?  After reviewing my proposed changes from my last post, it was decided that I should take a different approach.  The changes I needed to make weren’t substantial, and were in the same spirit as the initial PR, so I decided that updating made more sense then starting over.  All you have to do is update the code and push another commit to the branch.  Let’s assume we’ve made the changes we want to our code again.  Let’s verify that Git sees these updates…

Yep – Looks good so far.  Now we need to add these files to the commit just like last time…

git add .

So now the files are ready to be committed, let’s go ahead and make a commit…

git commit -m "Updated the ENV variables and the way they are set"

Perfect – So now let’s check and see if our remote (GitHub) is still defined…

All looking good – So now all we need to do is push the commit…

git push -u origin fluentd-elasticsearch-kibanafix


Let’s go check out our PR on GitHub and check the status…

Nice!  So the code update to our branch automatically got pulled into the PR we already filed.  So we’re all done!

On the next Git post, I’ll talk about the process of squashing commits.

Leave a Reply

Your email address will not be published. Required fields are marked *