Generated File: Do Not Edit Directly Edit the source files and rerun the generator.
Git Tips Slides
PageUp x2: previous · PageDown x2: next · Home: index

Merge PR base branch into current branch

scripts/git-merge-pr-base.sh

Git itself does not know "this branch was originally created from that branch". But GitHub, GitLab, and Codeberg know the base branch of the current PR/MR.

Instead of querying external APIs, the current tool I use is sync-branch. If you use VS Code, it automatically stores the base branch in your .git/config under branch.<name>.vscode-merge-base. The sync-branch tool reads this local configuration to reliably determine your parent branch and merge its latest changes. This is especially handy when working with a chain or train of branches, as it synchronizes your branch offline without having to explicitly type the base branch name.

Generated File: Do Not Edit Directly Edit the source files and rerun the generator.