Joe
Joe

Reputation: 15301

How to know the diff of what recently changed on files pulled using a pull operation

I perform a git pull operation and it fetched via few files. How can I run a diff and understand what really changed in all of those files or a selective set of files within that list.

Upvotes: 1

Views: 41

Answers (3)

William Seiti Mizuta
William Seiti Mizuta

Reputation: 7985

You can use the command git whatchanged. It will tell you what files were changed in each commit. If you pass the option -p, you can also see which lines are included/excluded in each commit.

Upvotes: 1

Dietrich Epp
Dietrich Epp

Reputation: 213268

First, you can use git reflog to show you the hash of the current commit and the previous commit that was checked out.

$ git reflog
ffb759d HEAD@{0}: commit: stuff
68dff16 HEAD@{1}: pull: Fast-forward
c718a6a HEAD@{2}: pull: Fast-forward
...

As you can see, the most recent change was a commit, and the previous two changes were pulls. If I want to see the changes in the most recent pull, I can:

$ git diff HEAD@{2} HEAD@{1}

Or I can look at just the changes to a specific directory,

$ git diff HEAD@{2} HEAD@{1} -- example/path

You can also browse the changes with gitk, gitg, gitx, et cetera.

Upvotes: 1

Jorge Israel Peña
Jorge Israel Peña

Reputation: 38576

Use git diff. There's a few places such as this article or this one which can get you up to speed on how to use it.

Upvotes: 0

Related Questions