2019-04-01 A trick with Git merging

I often have a pull request on BitBucket to review and merge, and – as an Emacs user – I find BitBucket’s UI less than ideal.

On the other hand, I don’t want to merge only locally and push, since I want BitBucket to generate the merge commit messages, close the PRs etc.

Today, I found a neat way to solve this problem. My solution is called git merge --no-commit --no-ff <branch-to-merge>. (The --no-ff makes sure we don’t accidentally perform an actual merge if the branch happens to be based on master or whatever we merge into.)

That command (which, by the way, seems not to have a Magit way of invoking!) leaves the repository in the stage “right before the merge commit”. This means that I can unstage all the changes, review them hunk by hunk (or line by line), staging things as I review them – something impossible (I guess) with BitBucket web UI.

As usual, Emacs’ user interface proves to be superior. Not that I’m surprised. ;-)

CategoryEnglish, CategoryBlog, CategoryGit