Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid vi "PopUp" when merging

Tags:

git

Sometimes git opens vi and shows me a message like this:

Merge branch 'master' into feature/heal-the-world

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

I always close the vi unchanged.

Is there a way to avoid this "vi PopUp"?

I would like to stay with my current workflow, I just want git to automatically do this. I don't want to switch to rebase.

Update

since some calls to git get done in scripts, I need a way to change the default behaviour of git. An alias which does what I need does not help here.

like image 683
guettli Avatar asked Jan 26 '26 04:01

guettli


1 Answers

You can use the --no-edit argument, to accept the auto-generated message.

git merge other_branch --no-edit

Unfortunately, there is no simple solution to make this the default behavior for all branches, as you can see in Configure git mergeoptions --no-edit on all branches. You can either specify this for all branches, or use an alias that will shadow the default merge, like in https://stackoverflow.com/a/44782300/2266261

like image 81
Dunno Avatar answered Jan 28 '26 19:01

Dunno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!