Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Devops
  3. Question
Devops

How to grep (search) committed code in the Git history?

Asked by Nishi Verma Jul 15, 2021 2.7K views 1 answer
Share

About this question

 I have deleted a file or some code in a file sometime in the past. Can I grep in the content (not in the commit messages)?

A very poor solution is to grep the log:

git log -p | grep

However, this doesn't return the commit hash straight away. I played around with git grep to no avail.

How to search git history?

Your answer

1 Answer

More Devops discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest DevOps Blogs

Guides, tips and career advice on DevOps from JanBask experts.