![]() ![]() The command above lists all the commits (including merge. ![]() I could confirm using git bisect that dde61dae0cf648e7f4dd8a5c194bcf9be1745793 is the commit I was looking for. It doesnt point to the revision where the line is deleted but leads to the last. But yeah, that's how far I got to find the specific spot of change where the string vanished. The git blame -reverse command gets close to where the line is deleted. But since we're using a diff between commits, did I made a mistake and there are other commits in-between? $ git log -pretty=oneline ba0b2d348f4e33857c96acf5a6231cf9d89ddb1b.dde61dae0cf648e7f4dd8a5c194bcf9be1745793ĭde61dae0cf648e7f4dd8a5c194bcf9be1745793 network interface No?!? Well, what's the diff then from that to our first found commit? $ git diff ba0b2d348f4e33857c96acf5a6231cf9d89ddb1b.dde61dae0cf648e7f4dd8a5c194bcf9be1745793 | grep "127.0.124.1" # Remove grep to see the full diff So does that mean dde61dae0cf648e7f4dd8a5c194bcf9be1745793 should contain that removal? $ git show dde61dae0cf648e7f4dd8a5c194bcf9be1745793 | grep "127.0.124.1" # Remove grep to see the full diff Which is dde61dae0cf648e7f4dd8a5c194bcf9be1745793, since this is the last one in this list we're looking for. # | tail -n1 # Uncomment to only show the last one Next we try to find the commit following after this one until HEAD: $ git rev-list ba0b2d348f4e33857c96acf5a6231cf9d89ddb1b. But how can you find out who deleted a line You can pseudo-git-blame a deleted line using either of the following, depending on whether you want to do a simple string matching search or use a regex: git log -S string. Which results in ba0b2d348f4e33857c96acf5a6231cf9d89ddb1b is our searched commit. git blame can tell you who last changed a file line by line. First, I tried git diff HEAD.HEAD grep some code, expanding the range each time, until I found the lines where it was removed. And thats good enough, but I was also curious to find where it got deleted, and so far, no dice. $ git show 857aa361293abbb351d6d6becaa55ec011aebc93 | grep "127.0.124.1" # Remove grep to see full diff I ended up finding where it was created with this: git log -prettyoneline -Ssome code. With '-S' or '-G', we can only find where it was added, not removed. ![]() I can't explain why Git works that way, but I'll elaborate my findings: I've found a way to find the specific commit, but it is only shown when diffing between these commits. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |