Question

I tried to retrieve last commit where the specific file was submitted (kind of "git log foo.cc"). Get all the commits and go through them. In the commit tree looking for the file. The problem is that all the commits contain the file I'm interested in. Does the commit tree suppose to contain the files which were submitted only or is it supposed that the tree contains the full tree at the time of commit?

If the tree is supposed to be full: How can I know if the file(TreeEntry) was modified in a specific commit?

Thanks!

Was it helpful?

Solution

In git every commit contains a representation state of entire the repository. For more info look here. The paragraph snapshots not differences is clear about why this choice was made. Note, that if the file didn't change between two commits the last commit just contains a pointer to the file in the previous commit. You could compare the pointers of two consecuting commits to spot differences. Another approach would be to use a diff tool as mentioned in the comment of Edward Thomson.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top