#author("2021-07-03T08:57:33+00:00","","") #author("2021-07-03T09:04:38+00:00","","") #topicpath /////////////////////////////////////////////////////////////////////////////// * 目次 [#q1f91182] #contents(); #ls2(VersionCtl/git/magit/); /////////////////////////////////////////////////////////////////////////////// * 導入方法(v.2.8.0) [#o28bdb87] - Linux の場合、ディストリビューションによっては用意されている場合もある -- debian の場合、 magit パッケージを aptitude install すると、即使えるようになる。 - リポジトリ: https://github.com/magit/magit.git - 最近のバージョンでは dash.el を必要とする。導入済みでない場合は用意しておく必要がある。 -- dash.el のリポジトリ: https://github.com/magnars/dash.el -- with-editor のリポジトリ: https://github.com/magit/with-editor.git - ${HOME}/.emacs.d/site-lisp/ 配下に手動インストールした場合の設定例。magit と dash に load-path も通す必要がある。 ; magit (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/dash") load-path)) (load-library "~/.emacs.d/site-lisp/dash/dash.el") (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/with-editor") load-path)) (load-library "~/.emacs.d/site-lisp/with-editor/with-editor.el") (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/magit") load-path)) (load-library "~/.emacs.d/site-lisp/magit/magit.el") - emacs23 以下の emacs 環境では、 defvar-local 関数が存在しない関係で、使える magit のバージョンは 1.2.2 以下となる。 - with-editor.el は元々 magit に組み込まれていたが、下記の commit 以降で外に出されており、別途自分で組み込む必要がある commit e87fe8180b6513450a110b7ad4fed887895720c3 Author: Jonas Bernoulli <jonas@bernoul.li> Date: Thu Jan 28 21:01:06 2016 +0100 move with-editor to its own repository /////////////////////////////////////////////////////////////////////////////// * コマンド version 2.8.0 [#z27e2276] |~binding |~command |~remark | | C-j |magit-diff-visit-file-worktree | | | C |magit-commit-add-log | | | K |magit-file-untrack | | | R |magit-file-rename | | | a |magit-apply | | | s |magit-stage | | | u |magit-unstage | | | <C-return> |magit-diff-visit-file-worktree | | | <remap> |Prefix Command | | | <remap> <magit-delete-thing> |magit-discard | | | <remap> <magit-revert-no-commit> |magit-reverse | | | <remap> <magit-visit-thing> |magit-diff-visit-file | | //============================================================================= ** diff [#fa7c1f5c] - リポジトリと差分のあるファイルのファイル名の上で "e" を type すると、emacs の ediff を利用した差分編集画面が起動する。 - この diff の画面は、ある時期に 2ペインから3ペインに変更されているが、これは "e" に割り当てられた関数が変更されたため。 |~画面 |~関数 | |2ペイン |magit-ediff-compare | |3ペイン |magit-ediff-dwim | - 最新の magit で、差分編集を以前の2ペインにしたい場合は、magit を読み込んだあとの方で、以下を記述する (define-key magit-mode-map "e" 'magit-ediff-compare) -- これで、若干面倒ではあるが(その代わり比較対象をどのブランチにするかなど、手動で都度選べるようにもなる)、2ペインの diff が使えるようになる。 -- 但し、conflict 解決の場合に magit-diff-compare を起動すると、(マージや rebase による)conflict 前後の比較ではなく、conflict した結果と現在の HEAD との比較となってしまう。この場合には magit-ediff-dwim を起動するようにする。~ → ''"e"'' と ''"E"'' で両者を使い分けると良いだろう。