LoginSignup
0
0

More than 1 year has passed since last update.

git format-patch/git am で emoji shortcode が消えてしまう問題を解決する

Last updated at Posted at 2022-10-19

TL;DR

git format-patch -k
git am -k

を使え

とは

git format-patch でコミットたちをファイルに書き出して git am でほかのリポジトリ or ブランチに移植出来て便利なんですが、その際

:tada: Add hogehoge

みたいなコロンで書かれた絵文字があると、git am のときに

tada: Add hogehoge

となってしまいます。

なんで?

git am はメールで来たパッチを適用するように作られてるので、 git mailinfo が気を効かせて

  • Leading and trailing whitespace.
  • Leading Re:, re:, and :.
  • Leading bracketed strings (between [ and ], usually [PATCH]).

を削除してくれるせいです。

どうするの?

git am -k を使いましょう。

ただ、git format-patch はデフォルトでは [PATCH 01/03] みたいなのを頭につけてくるので、git format-patch で出力したパッチはそのまま git am -k するとコミットメッセージの頭に余計なものがくっつきます。
git format-patch にも -k があるので git format-patch -k で書きだしましょう。

Ref

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0