在脚本中进行合并时如何在不编辑的情况下保存提交更改?

How to save commit changes without editing when doing a merge in a script?

我想知道如何在我的基本脚本中添加一些命令,包括 nano、Ctrl-O、Enter、Ctrl-X、Enter。您可以在脚本末尾看到我想要的内容。 git合并后,我只需要保存提交更改(形式)

#!/bin/bash

## Set Local Rebase ##
git config pull.rebase true

## Update OpenWRT Scripts
./scripts/feeds update -a
./scripts/feeds install -a

## 5.4 kernel
git remote add wrt https://github.com/james/openwrt.git
git fetch james
git checkout -b wrt james/kernel5.4-qsdk10.0
git checkout master
git merge wrt
*ctrl o*
*enter*
*ctrl x*
*enter*

无需与编辑器交互来设置合并提交消息,您可以使用 -m 标志指定提交消息而无需打开编辑器,或使用 --no-edit 接受默认消息。您还可以使用 git fmt-merge-msg 来帮助生成消息以传递给 -m,但这有点难。

使用--no-edit:

git merge --no-edit

使用-m

git merge -m "automated merge by my script"