{"thread":{"id":"26274","subject":"git diff","startedAt":"2011-01-13T22:46:16Z","lastAt":"2011-01-17T22:30:21Z","messageCount":2,"participants":["Carter Lamb","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"159453","messageId":"AANLkTik7cfu_DS=GS5gz_Tu94NC=ZGi-eA8YXztyd9Ra@mail.gmail.com","threadId":"26274","inReplyTo":"AANLkTi=ASvicFGaaDfqxjOxJELWPLKsQwvk7rEeT36Fh@mail.gmail.com","subject":"git diff","fromName":"Carter Lamb","fromEmail":"carter.lamb@livetext.com","sentAt":"2011-01-13T22:46:16Z","receivedAt":"2011-01-13T22:46:16Z","isPatch":false,"sender":{"key":"carter.lamb@livetext.com","avatar":null},"body":"I use git diff --summary --numstat <commit> to report the files\nmodified, created, and deleted between the current commit and some\nprior commit. The --stat and --numstat options count the lines added\nand deleted for each file. Is there a way to report the lines modified\nfor each file. For example:\n\nGiven content below for commit 1:\naaaaa\nccccc\n\nGiven content below for commit 2:\naaaaa\nbbbbb\nccccc\n\nGiven content below for commit 3:\nAaaaa\nBbbbb\nccccc\nddddd\n\ngit diff --numstat between commits 1 and 2 will report one line added.\ngit diff --numstat between commits 2 and 3 will report three lines\nadded and two lines deleted.\nI'd like to see the diff between commits 2 and 3 report two lines\nmodified and one line added.\nCan this be done?\n\nBest,\nCarter\n"},{"id":"159570","messageId":"20110117223021.GA31045@sigill.intra.peff.net","threadId":"26274","inReplyTo":"AANLkTik7cfu_DS=GS5gz_Tu94NC=ZGi-eA8YXztyd9Ra@mail.gmail.com","subject":"Re: git diff","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-01-17T22:30:21Z","receivedAt":"2011-01-17T22:30:21Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 13, 2011 at 04:46:16PM -0600, Carter Lamb wrote:\n\n> I use git diff --summary --numstat <commit> to report the files\n> modified, created, and deleted between the current commit and some\n> prior commit. The --stat and --numstat options count the lines added\n> and deleted for each file. Is there a way to report the lines modified\n> for each file. For example:\n\nNot really, because it's not well defined. Consider your example:\n\n> Given content below for commit 1:\n> aaaaa\n> ccccc\n> \n> Given content below for commit 2:\n> aaaaa\n> bbbbb\n> ccccc\n> \n> Given content below for commit 3:\n> Aaaaa\n> Bbbbb\n> ccccc\n> ddddd\n\nHow do we know that \"Aaaaa\" is a modification of line \"aaaaa\", and not\nsimply the deletion of the old line and the addition of a new one? It's\neasy to come up with a case where that is more obvious:\n\n  -aaaaa\n  +ddddd\n\nbut there are many shades of gray in between. Is:\n\n  -aaaaa\n  +Aaada\n\nthe deletion of an old line and the introduction of a new one, or the\nmodification of an existing line?  So fundamentally the diff format just\ndeals with added and removed lines, and modifications are represented as\na delete followed by an add.\n\nWhich isn't to say you couldn't think of many clever algorithms for\nheuristically determining a modification, but git doesn't do that itself\nin numstat.\n\n-Peff\n"}]}