LoginSignup
6
6

More than 5 years have passed since last update.

[atom/git]今のブランチで変更のあったファイルを全て開く

Last updated at Posted at 2015-07-16

動機

マージリクエストのレビュー時などに変更のあったファイルをエディタで開いて確認したいときがある.

今のブランチで変更のあったファイルのdiffを表示する

$ git diff $(git log --merges -1 --format=%H) @

今のブランチで変更のあったファイル名を表示

$ git diff $(git log --merges -1 --format=%H) @ --name-only

git aliasにする

.gitconfig
[alias]
  alias.mdiff=!git diff $(git log --merges -1 --format=%H) @

使用例

# 変更差分の表示
$ git mdiff

# tigと組み合わせる
$ git mdiff | tig

# 変更ファイルの表示
$ git mdiff --name-only

# 変更ファイルをエディタで開く
$ atom . `git mdiff --name-only`
# もしくは前回の実行コマンドを利用して
$ atom . `!!`

たぶんこんな感じ. 今回はatomを使ってみたけど, 他のエディタでも同じようにできると思う.

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