{"thread":{"id":"47672","subject":"Re: The original file that was split in 2 other files, is there a way in git to see what went where?","startedAt":"2018-01-23T03:22:27Z","lastAt":"2018-01-23T18:38:00Z","messageCount":4,"participants":["Aleksey Bykov","Jonathan Tan","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"337143","messageId":"CAMAMitC-iyH_YOAsJcPpLcUbmX-Zun4MCL89Pxn2rr7Lu_m2cQ@mail.gmail.com","threadId":"47672","inReplyTo":"CAMAMitCV3xvaSr00H574Pww=r_c3=0NqT1Ge13kc=gWJqDJ3Ug@mail.gmail.com","subject":"Re: The original file that was split in 2 other files, is there a way in git to see what went where?","fromName":"Aleksey Bykov","fromEmail":"aleksey.bykov@gmail.com","sentAt":"2018-01-23T03:22:21Z","receivedAt":"2018-01-23T03:22:27Z","isPatch":false,"sender":{"key":"aleksey.bykov@gmail.com","avatar":null},"body":"Hello,\n\nMy problem:\n\nI am a code reviewer, I have a situation in GIT:\n\n- before: a.txt\n\nThen a developer decided to split the content of a.txt into 2 files\nand add a few changes all in one commit:\n\n- after: b.txt + few changes and c.txt + few changes\n\nIs there an easy way to see:\n\n1. what came to b from a?\n2 .what came to c from a?\n3. all extra changes apart from just moving stuff?\n\nA specific command would help a lot.\n\nA certain policy/workflow that prevents from problem like this (when\nthere is no way to visually diff the changes) would also help.\n\nhttps://stackoverflow.com/questions/48350398/the-original-file-that-was-split-in-2-other-files-is-there-a-way-in-git-to-see\n\n\nThanks,\nAleksey Bykov\n"},{"id":"337160","messageId":"CAGf8dg+XPPrx+Fv5d2hTgBMyWDBavFvOmXzJiX+8PuHBSoUCrw@mail.gmail.com","threadId":"47672","inReplyTo":"CAMAMitC-iyH_YOAsJcPpLcUbmX-Zun4MCL89Pxn2rr7Lu_m2cQ@mail.gmail.com","subject":"Re: The original file that was split in 2 other files, is there a way in git to see what went where?","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2018-01-23T16:32:00Z","receivedAt":"2018-01-23T16:32:08Z","isPatch":false,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"On Mon, Jan 22, 2018 at 7:22 PM, Aleksey Bykov <aleksey.bykov@gmail.com> wrote:\n> Is there an easy way to see:\n>\n> 1. what came to b from a?\n> 2 .what came to c from a?\n> 3. all extra changes apart from just moving stuff?\n\nOne way to do this is to use \"--color-moved\" - it will tell you what\nin b.txt and c.txt was moved and what wasn't (although it won't tell\nyou from where). This was introduced recently, I think in 2.15.\n"},{"id":"337164","messageId":"20180123165545.GI13068@sigill.intra.peff.net","threadId":"47672","inReplyTo":"CAMAMitC-iyH_YOAsJcPpLcUbmX-Zun4MCL89Pxn2rr7Lu_m2cQ@mail.gmail.com","subject":"Re: The original file that was split in 2 other files, is there a way in git to see what went where?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-01-23T16:55:45Z","receivedAt":"2018-01-23T16:55:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jan 22, 2018 at 10:22:21PM -0500, Aleksey Bykov wrote:\n\n> I am a code reviewer, I have a situation in GIT:\n> \n> - before: a.txt\n> \n> Then a developer decided to split the content of a.txt into 2 files\n> and add a few changes all in one commit:\n> \n> - after: b.txt + few changes and c.txt + few changes\n> \n> Is there an easy way to see:\n> \n> 1. what came to b from a?\n> 2 .what came to c from a?\n> 3. all extra changes apart from just moving stuff?\n\nJonathan suggested the new \"--color-moved\", which I second as a good way\nof seeing what was moved, and which lines were changed.\n\nFor seeing which line came from where, you might try \"git blame -C\",\nwhich will cross file boundaries looking for the source of lines.\n\nFor instance, here's a case in git where some code was moved:\n\n  git blame -C ae563542bf10fa8c33abd2a354e4b28aca4264d7 revision.c\n\nYou can see which lines are new to the file, and which ones were moved\nfrom elsewhere.\n\nIf you want to simplify the \"noise\" of seeing the actual origin of each\nline, you can ask blame not to go further back. Like:\n\n  commit=ae563542bf10fa8c33abd2a354e4b28aca4264d7\n  git blame -b -C $commit^..$commit revision.c\n\nThat will leave the commit id blank for every line that wasn't touched\nas part of the commit (or if you had a whole series of commits, replace\n\"$commit^\" with the parent of the series).\n\nAnd finally, if you're going to do a lot with \"git blame\", I'd look into\nthe \"tig\" tool as a prettier interface. You should be able to do \"tig\nblame -C ...\" in the same way.\n\n-Peff\n"},{"id":"337171","messageId":"xmqq8tcoifpa.fsf@gitster.mtv.corp.google.com","threadId":"47672","inReplyTo":"20180123165545.GI13068@sigill.intra.peff.net","subject":"Re: The original file that was split in 2 other files, is there a way in git to see what went where?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-23T18:37:53Z","receivedAt":"2018-01-23T18:38:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Jan 22, 2018 at 10:22:21PM -0500, Aleksey Bykov wrote:\n>\n>> I am a code reviewer, I have a situation in GIT:\n>> \n>> - before: a.txt\n>> \n>> Then a developer decided to split the content of a.txt into 2 files\n>> and add a few changes all in one commit:\n>> \n>> - after: b.txt + few changes and c.txt + few changes\n>> ...\n> For seeing which line came from where, you might try \"git blame -C\",\n> which will cross file boundaries looking for the source of lines.\n> ...\n> And finally, if you're going to do a lot with \"git blame\", I'd look into\n> the \"tig\" tool as a prettier interface. You should be able to do \"tig\n> blame -C ...\" in the same way.\n\nAll excellent guides.  \"blame\" is good at explaining where things\ncame from, but not as good at explaining, starting from an old\nstate, where things went.  \"blame --reverse\" does a decent job\nwithin the constraints its output format has, but not quite ideal.\n\n"}]}