1

There is a log/ dir in git repo, and under it resides a file called history.txt.

I want to know when the keyword linux programming first occur in history.txt or log/, means find the date of the first commit contain the keyword.

Is that possible?

Eric
  • 22,183
  • 20
  • 145
  • 196
  • You can use the `find` command, although it depends on what os you are. – TomTsagk Dec 10 '15 at 04:58
  • @TomTsagk The find command can only search the current working dir, right? It can't search history of git I think. – Eric Dec 10 '15 at 05:00
  • I believe you can specify another directory, you can try `man find`. – TomTsagk Dec 10 '15 at 05:47
  • @TomTsagk By `current working dir`, I mean in the sense of git, e.g in git you can check out different branch or commit, which might has different content. Thus `find` command could find a specific commit, but it can't search the whole history & tell when that change occur. – Eric Dec 10 '15 at 05:56
  • oooh well can't you search on `history.txt` as you said in your question? I'm new at `git` and I'm not sure how old commits (or snapshots) are saved. I see there is already an answer and seems good (didn't know git had internal command). – TomTsagk Dec 10 '15 at 06:26

1 Answers1

1

You can use a pickaxe search

git log -S"linux programming" -- log/

Take the oldest commit returned by that command (| tail -1), and you will get your date.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250