I actually haven't really run into issues with deleting code instead of commenting it out. Part of it is probably being able to search through the history effectively. There's the basics like being able to go back a blame and being able to see previous versions of a file from your editor. But there's probably some more advanced things which could be used for this specific problem.
The first thing which pops into my mind is git log -p and then search using /<search for something> in the less program (which is the default pager for git). Press n to go to the next match.
You can also use git grep to search through multiple revisions. Lets say you want to search through all the revisions in your current branch - you could run something along the lines of git grep '<search for something>' $(git rev-list HEAD). I've never had to use this particular combination before though, might be overkill.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I actually haven't really run into issues with deleting code instead of commenting it out. Part of it is probably being able to search through the history effectively. There's the basics like being able to go back a blame and being able to see previous versions of a file from your editor. But there's probably some more advanced things which could be used for this specific problem.
The first thing which pops into my mind is
git log -p
and then search using/<search for something>
in the less program (which is the default pager for git). Pressn
to go to the next match.You can also use
git grep
to search through multiple revisions. Lets say you want to search through all the revisions in your current branch - you could run something along the lines ofgit grep '<search for something>' $(git rev-list HEAD)
. I've never had to use this particular combination before though, might be overkill.