1

Rephrase: I would like to find the two last commits that changed a specific file (or folder, or group of files if possible) and perform a diff between those two commits. All in one command.

Thanks, this is going to save me time when I try to visualise what are the changes in data files that I re-populate with new scripts.

1
  • I actually wrongly rephrased the title, here's how to do the title question following larsmans' answer: git diff $(git log --format='%H' -2 -- "$path") -- "$path" Commented Jan 31, 2014 at 10:53

2 Answers 2

3
git diff $(git log --format='%H' -2 -- "$path")

Where path is obviously the path of the file you want to inspect.

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

Comments

0
git diff $(git log -2 --oneline -- MyFile.txt | cut -d " " -f 1)

Comments

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.