I have a deleted line in a file in my Git repository. I knew some of the missing text, and the file that it was in, so I used git log -S'missingtext' /path/to/file
.
However, the only thing that came back was the commit in which I added the line containing the missing text. The text wasn't present in HEAD, and the commit that added it was present in my branch, so I knew that one of the commits in my branch's history must have removed it, but it wasn't showing up.
After some manual searching, it turned out that the line was removed accidentally while resolving a conflict for a merge. So I'm wondering:
- Is this the reason why pickaxe couldn't find the commit that deleted the line?
- How could I have found where "missingtext" was deleted without digging through the history manually?
Any insight on #1 would be great (I assumed that git log -S
would give me my answer), but my real question is #2 since I'd like to be able to avoid this in the future.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…