6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gitで特定のキーワードが初めて出現したコミットを探す方法

Last updated at Posted at 2015-01-14

※コメントにてよりスマートな解決方法を提示して頂いたので、そちらを確認下さい。

git bisect と grep を組み合わせて使います。
下記の通り。

git log --reverse

を実行してinitial commitのハッシュ値をメモ。

git bisect start

bisect 開始。

git bisect bad

HEADをbad(=キーワードが既にある)状態として設定。

git bisect good <initial commit のハッシュ値>

initial commitをgood(=キーワードがまだない)状態として設定。

git bisect run sh -c "! grep -R <キーワード> <検索ディレクトリ>"

bisect の判定条件として、grepのキーワード検索結果を利用します。

6
6
2

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?