Agreed that AST diff is better, but there's also just better diff algorithms like the lesser-known Tichy diff: https://www.researchgate.net/publication/220439403_The_Strin... that I learned from http://bryanpendleton.blogspot.com/2010/04/more-study-of-dif... ; it seems to preserve more context and is better suited for big code refactors.