Rebasing PR branches right from GitHub.com

Amit Merchant · February 7, 2022 ·

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.

👋 Hi there! I'm Amit. I write articles about all things web development. If you like what I write and want me to continue doing the same, I would like you buy me some coffees. I'd highly appreciate that. Cheers!

Comments?