How to disable the merge message in git pull?

Asked

Viewed 447 times

3

Every time I git pull, git opens the text editor requesting a message for the merge commit. However this message is already loaded (as in the example below) and I simply save and close the window to finish the procedure.

Merge branch 'dev' of https://bitbucket.org/myproject into dev

In the case of my team, it makes no sense to personalize this message.
How do I disable this request?

3 answers

3


The command you want is

$ git pull --no-edit

Personally I prefer to use --no-edit when I do git merge and not in git pull because it is important for me to know when the HEAD from my local repository does not match to the remote.

2

This message only happens when you make one git pull and the remote repository received new commits.

How git needs to reconcile new commits with his commit local, by default it will make a 3-way merge and create this new commit of merge, consequently showing this message if you want to modify it.

One way to avoid this is to use the git pull --rebase, so he’ll recreate the commits locations from a new Parent (in case the remote HEAD) and will not have this problem with the commit of merge.

For more details see some references:

  • I wouldn’t want to change the commits. I just want to know if it is possible not to request the customization of the commit message, always using the same default message.

  • 1

    This strategy works, but it’s constantly rewriting the branch history at each location. For some flows this works better than for others, depending on how developers work and maybe the size of the changes in each location.

0

Are you interested in committing immediately? if this is your goal depending on the manager you use in the case of gitkraken or sourcetree you have the possibility to mark merge immediately after the merge commit (if there is no conflict) then you do not need to write or do anything just send to origin, just push. The message is only in case of interest in personalizing I believe.

  • For everyday trivial use I prefer to use the same terminal. I look for a solution next to the terminal.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.