11
9

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.

Emacs Magit2 Rebaseチュートリアル

Last updated at Posted at 2016-04-17

1. Magitの画面を開きます。

M-x magit-status

2. Log一覧を表示します。

M-x magit-log-popup (l l)

3. rebase範囲を指定

例えばmy commit 5fixup(前のコミットへ含める)するとします。

mg2.png

my commit 5のひとつ前my commit 4の位置にカーソルを移動し
M-x magit-rebase-interactive (r i)

mg3.png

この画面ではC-c C-kでrebaseのキャンセルが可能です。

4. rebase内容を指定

mg4.png

my commit 5の位置で f を押してfixupマークを付けます。

keybind mark description
c pick 何もしない
e edit 編集
s squash ひとつ前のコミットに含める
f fixup squashと同じだがメッセージの編集はしない
r reword メッセージの編集

C-c C-cでマークした内容を確定させます。

今回はfixupのみため、my commit 5がログから消え、
my commit 5の変更内容は my commit 4 に結合されます。

editマークを付けて編集中に混乱した場合はM-x magit-rebase-abort (r a)で破棄できます。

rebase前の状態に戻したい

M-x magit-reflog-head

mg5.png

rebaseを完了する直前のmy commit 8にカーソルを置き、M-x magit-reset (x)で戻します。

11
9
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
11
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?