LoginSignup
2
0

More than 3 years have passed since last update.

blameとshowを使って履歴を確認する

Posted at

ファイルの変更履歴を見たい時に使います。

まず、git blame <file name>を使用すると以下のように変更履歴が出力されます。

f68afe1e (taro tanaka        2020-10-07 22:02:39 +0900 52)   
40b0c3f7 (hajime suzuki        2020-10-13 21:33:15 +0900 53)   
c41a8d0b (hajime suzuki        2020-10-08 20:36:37 +0900 54)     
5d94494b (taro tanaka        2020-10-13 20:33:46 +0900 55)       
00000000 (Not Committed Yet 2020-11-05 08:58:55 +0900 56)         
c41a8d0b (hajime suzuki        2020-10-08 20:36:37 +0900 57)    

左から順に、
コミット番号・コミッター・変更日時・ファイル行番号となっています。
(なお、本来は行番号の右に行に対応するソースも結果に出力されますが本稿では省略しています。)

さて、コミット番号がわかったのでコミット番号を使用してgit show <commit No>を使用してみます。
すると、以下のように具体的にどのような修正を行ったのかがわかります。

commit 40b0c3f7435331cdc08ccbaa021808c520e02b1b
Author: taro tanaka <mail@example.com>
Date:   Tue Oct 13 21:33:15 2020 +0900

    デザインの修正

diff --git a/src/components/Play.js b/src/components/Play.js
index 771f237..e6f195f 100644
--- a/src/components/Play.js
+++ b/src/components/Play.js
@@ -36,22 +36,28 @@ const Play = () => {
     );
   }
   return (
-    <div>
+    <div className='quiz_main'>
       <h1>クイズを出題します</h1>
       <div className="question">
-        { quiz[quizNum].quiz}

個人のリポジトリではあまり使用する機会もないと思いますが、チームで開発する場合に誰がどのような修正をしたのかを手っ取り早く知りたい場合は便利かと思います。

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