LoginSignup
2
0

More than 3 years have passed since last update.

git diffの出力を整形する

Posted at

全て出力

$ git diff
diff --git a/file b/file
index edd13ee..d0f4198 100644
--- a/file
+++ b/file
@@ -1,3 +1,3 @@
 aaaa
 bbbb
-cccc
+dddd

+/-の差分情報だけ欲しい

そんなオプションはなかった。ゴリ押しで実現

$ git diff --unified=0 --exit-code | grep -E "^[-\+]" | grep -vE "\-\-\-|\+\+\+"
-cccc
+dddd
2
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
2
0