1

I was trying to do this which didn't show anything different How to get the changes on a branch in git

I did a branch from master and since then changes have been made on master and my branch (called performance). All I want is

  1. The list of files changed/touched since branching "performance" branch (all files were committed)
  2. Show the complete difference of all those files changed/touched.

When doing git diff origin/master, it lists all changes on both branches :(.

What is the command since git diff HEAD..performance shows nothing(and ... also shows nothing)? Also, using log in the same way with .. and with ... also shows nothing.

If I do git log, I do see the commit I made on the performance branch with my comment about performance as well.

thanks, Dean

2
  • Can you try this and see if its what you are after? git diff hash1 hash2 Commented Jul 5, 2013 at 17:18
  • I don't know which hashes to use as I only know the last commit was on this branch but I am not sure about the other commits and where it finally forked from master branch. Commented Jul 5, 2013 at 17:28

1 Answer 1

2

First, find the branch point. You can do this with the merge-base command:

$ git merge-base performance master
cafebabe01234567...

Note: If you don't remember the merge-base command, you can always use gitx/gitk/gitg/etc. to find the branch point visually.

Then, you can do a diff from the branch point to the tip of the performance branch:

$ git diff cafebabe01234567... performance

Or, in a single line,

$ git diff $(git merge-base performance master) performance

Remember that git diff takes options, if you want to change how it displays the differences. See the man page.

Sign up to request clarification or add additional context in comments.

8 Comments

Cheers, I'll know the next time!
well, it is definitely giving the wrong fork revision as the date on that is way way back in May and I just created this branch yesterday sometime. Why would it give me something from May on what is a very new branch?
oh, and I took the hash from git merge-base performance master and then did a git log and searched for the hash and it is way back in May which is definitely wrong.
oh crap. this really screwed things up. I ran that command on performance branch which gave me that hash but then when I did git checkout master to get back on master, it says I am behind by 238 commits...it wasn't doing this a few hours ago when I was on master branch and switching back and forth....how do I fix this? I thought the command you gave me was not modifying anything but it seems to have done some stuff that I didn't want to do to my repository. My performance branch is local as well so I can't just blow away and clone :( :(
ah crap, did a git pull, go back to performance branch and run same merge-base command and now it gives a different hash...this just screws things up worse
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.