0

I did commit 4cc698b, and git branch --contains shows the correct branch with this commit.

After two weeks I saw what my code doesn't exist. But when I try to find who deleted my code, with git log -S, it shows only the 4cc698b commit.

Does Git have another way?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Hello
  • 98
  • 6
  • You can go over the commits one at a time and see which was the content. – skypjack Nov 13 '15 at 06:47
  • Possible duplicate of [How do I "blame" a deleted line](http://stackoverflow.com/questions/4404444/how-do-i-blame-a-deleted-line) – rmunn Nov 13 '15 at 06:49
  • As suggested in that question, try `git blame --reverse HEAD..4cc698b`. That will show you the last commit in which the line(s) in question existed. Then do normal `git log` (or `git log -p`) to find the next commit after that one; that should be the commit that deleted the lines. – rmunn Nov 13 '15 at 06:51
  • `git blame --reverse HEAD..4cc698b` show my today `git pull` merge for all file lines – Hello Nov 13 '15 at 07:03
  • try: git log -p > somefile . Then open somefile and search for the code that was deleted. Then scroll up. You should see the commit where it hapenned. – JoelFan May 14 '20 at 22:26

0 Answers0