1

I'm working with a remote repository on a project. What I did just now was fetch the master branch and merge it with my local master branch. It showed that three files were affected. So far so good.

Now I want to see what the other person changed in one of these files. Let's say that file is Models/GetUser.php. I tried git diff Models/GetUser.php but of course that won't work as the changes are merged by now.

How can this be done?

ankush981
  • 5,159
  • 8
  • 51
  • 96

1 Answers1

1

You can do a git log -- Models/GetUser.php that will give you all the commit messages for a specific file.

To check actual changes you do this.

git diff <revision_1>:<file_1> <revision_2>:<file_2>

or

git diff <start_commit>.. <end_commit> -- path/to/file

Here is a link to similar question on SO.

Community
  • 1
  • 1
Shane van Wyk
  • 1,870
  • 1
  • 26
  • 62
  • The problem is that the developer changed several files in that commit, and so didn't provide comments for each file. I want to see exactly what code has changed. – ankush981 Apr 20 '15 at 03:56
  • Check my edit, you should be able to do a `git diff , and you can get that revision number from `git log`, so the log will show you all the commits made, then the diff will show you all the changes made to a file based on that commit start. – Shane van Wyk Apr 20 '15 at 03:59