
なのまるです~
git の自動化を行っているとおかしなことが起きて困ったので、対処法メモです!
もくじ
gitを使ったスクリプトを実行したときに発生した問題
中では、[git pull] をしているわけですが、1 2 3 4 5 6 7 | Merge branch 'master' of git.example.com:configuration /hogehoge # 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. |
何かいい方法がないか、社内で確認しました。
- 一度、rmして「git clone」し直せば?
- git fetch ; git reset --hard origin/master
「git pull --no-edit」オプションで解決
結局、manから
123456789101112--edit, --no-edit
Invoke an editor before committing successful mechanical merge to further edit the
auto-generated merge message, so that the user can explain and justify the merge.
The --no-edit option can be used to accept the auto-generated message (this is
generally discouraged). The --edit option is still useful
if
you are giving a
draft message with the -m option from the
command
line and want to edit it
in
the
editor.
Older scripts may depend on the historical behaviour of not allowing the user to
edit the merge log message. They will see an editor opened when they run git
merge. To
make
it easier to adjust such scripts to the updated behaviour, the
environment variable GIT_MERGE_AUTOEDIT can be
set
to no at the beginning of them.
--no-editオプションを付けることで解決しました!
環境変数に設定しても回避は可能
環境変数に1 | export GIT_MERGE_AUTOEDIT=no |
- このユーザーすべてのgitに影響する
- 新しくセットアップした時に、確実に忘れるw
参考:
「git pull」は「git fetch + git merge」と同じ
git pullは内部で「git fetch + git merge」と同じなんだよ!ってことを教えてもらいました!そう考えると、なるほど!ってことが頭で理解できるようになってきました。
参考:
まとめ
- [git pull --no-edit]で解決です!
- 環境変数でも設定は可能ですよ!
- gitはまだまだ、奥が深かったw