Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change PR merge commit message?

Tags:

azure-devops

When pull requests are created, their commit message is always like "Merged PR### from {branch name} into {target branch name}"

I keep amending commit messages and this is a bit tiring. I rely on the commit messages to keep track, so the automatic messages present a problem.

like image 982
Nomenator Avatar asked Apr 11 '19 15:04

Nomenator


People also ask

How do I change the commit message in merge request?

On the command line, navigate to the repository that contains the commit you want to amend. Use the git rebase -i HEAD~n command to display a list of the last n commits in your default text editor. Replace pick with reword before each commit message you want to change.

How do I change a pushed commit message?

Changing the latest Git commit message If the message to be changed is for the latest commit to the repository, then the following commands are to be executed: git commit --amend -m "New message" git push --force repository-name branch-name.

How do I delete a merge commit message?

How to Undo a Merge Commit in Git. You can use the Git reset command to undo a merge. Firstly, you need to check for the commit hash (or id) so you can use it to go back to the previous commit. To check for the hash, run git log or git reflog .


1 Answers

This is a feature of Azure DevOps, the purpose is making it clearly to describe what happened for each commit.

For the commit message with a merged commit by pull request, the default commit message is defined by the git server side (such as Azure DevOps, github etc) where your git repo hosted.

And it's a good habit to add the pull request information in commit message since the commit is merged by PR.

As you found, the default merge commit message in VSTS pull request like Merged PR <pull request ID>: branch1 to branch2.

Additional, such as GitHub, the default merge for pull request like Merge pull request #<pull request ID> from account/branch.

If you want to use your own commit message for merging Azure DevOps pull request, just custom the commit message as you need in the text box before clicking Complete merge button (such as change the default message Merged PR 118: master to b1 in text box in below example).

enter image description here

like image 140
PatrickLu-MSFT Avatar answered Oct 01 '22 21:10

PatrickLu-MSFT