2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Magit の cherry-pick で squash 的なものをやるやり方

2
Last updated at Posted at 2017-09-27

Magitはたまに操作体系を変えてくることがあるので Magit 20170913.1424 のバージョンでの話と思ってください。

いくつかコミットを取り出してそれを一つのコミットに圧縮して別のブランチに適用したいときは (以下特に注釈がないときは Magit 上での操作です)、

  • Lo (Log Other) 等で取り込みたいコミットの存在するブランチのログを表示させる
  • 表示されたログで C-space などを使ってコミットを選ぶ
  • Aa (Cherry Apply) を使ってワーキングツリーとインデックスに選択したコミット内容を取り込む。このコマンドが実行されて競合がなければ選ばれたコミットがワーキングツリーに適用されインデックスに add された状態になっています
  • あとは cc → コミットメーッセージ編集 → C-c C-c と通常のコミット手順と一緒です

以上

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?