Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Getting Started With Git Looking Back on What We've Done

git log doesn't show file name?

git log doesn't show the name of the file? how do you know what file you're seeing in the log?

4 Answers

alborz
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
alborz
Full Stack JavaScript Techdegree Graduate 30,885 Points

Hi Robert,

If you're wondering about how to know what changes were made in between commits, you can do that by using the diff command.

When you use git log to see the list of different commits, you can then later compare changes between earlier and subsequent commits, thus knowing the changes made to the files.

For example, when I type git log, I get a list of the different commits made like "Made changes to x" or "Added y". Each commit comes with a different unique identifier that should look like: "commit 438hfhej2349587dnfj". You can compare changes made between commits to view changes made to files by typing the different identifiers after each other after you type git diff: git diff 498ghdj 587fndm.

The terminal will then render changes made between files as well as show the name of the file where changes were made.

Hope this helps.

Thanks, but I'm still confused as I don't see the file name appear in the log, only the identifier. What if I wanted to get the identifier for file 1, so i could do a diff on two different versions. Maybe this is something I just need to get used to but I find it confusing as I don't see the file name, just the identifier. The identifier doesn't really mean anything to me, what I'd prefer to see is the actual file name along with the identifier.

alborz
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
alborz
Full Stack JavaScript Techdegree Graduate 30,885 Points

Right. It seems to me that things could get overwhelming if we saw each and every file changes rendered as soon as we hit git log. I think by simply writing out the changes one made when making a commit and leaving an automatic associated identifier with it, it makes things more compact and simple to then go ahead and go back to see changes; that way seems more targeted and clutter-free to me, which seems easier then if you were working on a large project that's been around for a while.

Just my opinion.

Mohsen Qaddoura
Mohsen Qaddoura
22,237 Points

The identifier refers to a 'commit' (a timed snap of all your project's tracked files' state at the moment of the commit) not to a certain file of your project. A commit might have changes to multiple files. Git is akin to a time machine that travels through your project files past/history, showing your files as per their state at a certain point of time. While at a certain commit you can see your files contents by opening them as you would do normally but they will show as they were at the time of that particular commit.