Get "PHP 8 in a Nuthshell" (Now comes with PHP 8.3)
Amit Merchant

Amit Merchant

A blog on PHP, JavaScript, and more

Rebasing PR branches right from GitHub.com

More often than not, you would end up in a scenario where you created a new branch off from the base branch, you implemented the feature and once that is done, you raise a pull request for the same.

Now, the base branch can get updated while the PR is still in the code review for example and so, the PR branch is now is lagging from the base branch.

The obvious thing you would do is to rebase your branch with the base branch in your local by fetching the latest from the remote and then pushing your changes back to the remote. And that will make your branch up-to-date.

This process is quite cumbersome since you’ve to go back and forth from your local to remote.

But recently, GitHub has released a new feature that lets you do this right from the browser.

The “Update with rebase” option

GitHub recently introduced a handy “Update with rebase” option (under the “Update branch” button) using which you can rebase your feature branch with the base branch, skipping the terminal part entirely.

Keep in mind that, you would only get to see the “Update branch” button only if you have checked the “Always suggest updating pull request branches” option under General > Pull Requests repository settings.

And that’s it! You can rebase your PR branches from GitHub.com just like that. It’s quite handy in my opinion.

Like this article? Consider leaving a

Tip

👋 Hi there! I'm Amit. I write articles about all things web development. You can become a sponsor on my blog to help me continue my writing journey and get your brand in front of thousands of eyes.

Comments?