foxygoat / git-scripts

0 stars 1 forks source link

git-pr-update: Add script to update PR branch #21

Closed camh- closed 3 years ago

camh- commented 3 years ago

Extend git-pr-merge to update a PR branch when called as git-pr-update. This is very similar to pressing the "Update branch" button on the github PR web UI, except it does not create a foxtrot merge - the merge commit added to the branch has the base branch (usually master) as the first parent.

When git-pr-merge merges a branch that has one of these update merge commits at the HEAD, it just fast-forward merges into master instead of creating a merge commit.

The end result of this is that a proper non-foxtrot merge commit is created as the merge to master, yet CI still runs on the branch so one can have confidence when merging a non-up-to-date branch into master.

This will make merging easier when operating on a busy repository as you do not need to keep rebasing your branch to make it up-to-date for merging, and you do not add foxtrot merges.

camh- commented 3 years ago

@juliaogris said:

maybe this should also say: if "require branch to be up-to-date" is enabled, there is no other way of merging or so.

I sort of say that in the next paragraph, and this is not quite right either. You could rebase/reapprove so there is another way of merging.