Detail change after Git pull


After a Git pull, its output gives a summary on the change amount.

How can I see each or some of the files detailed changes?

Okay, here is my question to Jefromi:

  1. How do I know if I was pulling to master? All I did is “git pull”.
  2. What does master point to and what is the difference between master and HEAD, the two default heads of Git?
  3. How do I see the detailed change in a specific file?
  4. How do I see the change in the summary output by the last git pull again?
  5. What’s difference between git diff and git whatchanged?


Suppose you’re pulling to master. You can refer to the previous position of master by master@{1} (or even master@{10.minutes.ago}; see the specifying revisions section of the git-rev-parse man page), so that you can do things like

  • See all of the changes: git diff master@{1} master
  • See the changes to a given file: git diff master@{1} master <file>
  • See all the changes within a given directory: git diff master@{1} master <dir>
  • See the summary of changes again: git diff --stat master@{1} master

As for your question of “how do I know if I’m on master”… well, using branches is an important part of the Git workflow. You should always be aware of what branch you’re on – if you pulled changes, you want to pull them to the right branch! You can see a list of all branches, with an asterisk by the currently checked-out one, with the command git branch. The current branch name is also printed along with the output of git status. I highly recommend skimming the man pages of commands to use – it’s a great way to slowly pick up some knowledge.

And your last question: HEAD is the name for the currently checked out branch. You can indeed use HEAD and HEAD@{1} in this context as well, but it’s a bit more robust to use the branches, since if you go and check out another branch. HEAD is now that second branch, and HEAD@{1} is now master – not what you want!

To save having to ask a lot of little questions like this, you should probably have a look at a Git tutorial. There are a million on the web, for example:

Leave a Reply