On Thu, Mar 03, 2022 at 11:12:08PM -0800, skybuck2000 wrote: >> There's no such support built into Git (because this simply goes >> perpendicular to its data model, where multiple versions are recorded for >> the same file (well, actually, they are recorded across the content of all >> the files in the project [...] > What I would like also is for these differences to be visible on > github/commits.
This is not possible due to the reasons I have presented above. You can commit the addition of file1.txt, then commit the addition of file2.txt which contents is based on that of file1.txt, but this does not mean anything to Git: there are two different files. Think of it this way: suppose your project has 100k files (think of Linux, for instance), and in a particular commit you change two of them - do you expect Git to show you a set of differences between each of these files and 99999 other files, totaling 2×99999 differences? I hope not. Git does have certain machinery to help detect "data movements" across files: `git log` supports -M and -C command-line options which control detection of movements and copies. This may help drill down the history of data in a particular file in the presense of past movements/copies of that data across the files in the project. > - `git diff` can work on files. > > > Yes I have seen this before, but it was not quite intuitive... > > I would expect it to work with > > git diff filea fileb That's possibly because by default it works on whole project snapshots, which _is_ intuitive once you think more about the fact it's `git diff`, and not just `diff`. It's able to diff individual files (as recorded in specified commits), though. > but from what I can remember it may have to work differently based on what > files are in the repo, though I could be wrong, tomorrow I will experiment > some more with this git diff and creating patches. I recommend reading the docs instead of theorizing and experimenting. [...] -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/20220304084942.laeyis7dyiqcczws%40carbon.
