Git; code for a whole function disappeared after a merge

If you know an identifiable section of the code which has been lost, you may be able to find the exact merge which lost your code by using git log -G regexToSearchFor -m --patch

  • -G <regex> tells Git to “Look for differences whose patch text contains added/removed lines that match <regex>
  • -m tells Git to include merge commits
  • --patch tells Git to show a diff of whatever it finds

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)