とある理由で$ git blame
を叩くことになったのでついでにメモ。
Show what revision and author last modified each line of a file
ファイルの各行の最後に修正した著者とリビジョンを表示する。ですね。
例
$ git blame app/models/user.rb 7a4b660d (kogamitsuhiro 2023-10-09 08:20:56 +0900 1) class User < ApplicationRecord b786cb58 (kogamitsuhiro 2023-10-08 21:35:15 +0900 2) # Include default devise modules. Others available are: b786cb58 (kogamitsuhiro 2023-10-08 21:35:15 +0900 3) # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable b786cb58 (kogamitsuhiro 2023-10-08 21:35:15 +0900 4) devise :database_authenticatable, :registerable, b786cb58 (kogamitsuhiro 2023-10-08 21:35:15 +0900 5) :recoverable, :rememberable, :validatable b786cb58 (kogamitsuhiro 2023-10-08 21:35:15 +0900 6) include DeviseTokenAuth::Concerns::User b786cb58 (kogamitsuhiro 2023-10-08 21:35:15 +0900 7) end
みたいな感じです。
普段私はVSCode使っていて、gitlensという拡張機能を入れるとまさにgit blame
と似たような情報が表示されます。
そのため使用頻度は低いですが、そうすると使わなくて完全に忘れそうなのでメモでした✍️