Steve Bennett
Steve Bennett

Reputation: 125995

List key git commits between revision A and B

I'm trying to understand the relationship between two git commits that are some distance apart in git spacetime. They both touch the same piece of code, but somewhere along the line for one of them, the code got moved to a different file.

What I think I want to do is this: view a simplified git log that shows 'key' commits. Initially, this would be revision A, revision B, and their common ancestor. But, as I identify other relevant commits, I'd also like to be able to see those, in something like the git log --graph format.

Issues so far:

  1. git log --all A...B starts at B, shows many commits, and I'm not sure what the significance of the final commit it shows is. (It's not A)
  2. I can't work out any way to filter down the huge number of commits. --simplify-by-decoration helps in other cases, but not here (eg, it doesn't show the actual commits I specified).

Sorry if this isn't clear. It's not easy to explain the kind of information that would be helpful until you see it.

EDIT

Ok, I'll try and spell it out. Call the target commits a123 and b234, with c345 another 'key commit' I've identified, and d456 is the common ancestor:

git log <something>  a123 b234 c345

d456
| |
| c345 <description, diff of key file>
| |
| b234 <...>
|
a123

Upvotes: 1

Views: 623

Answers (1)

ellotheth
ellotheth

Reputation: 4503

It sounds like you're looking for the pickaxe (git log -S"code to search") or blame (git blame -C file).

See also: http://jfire.io/blog/2012/03/07/code-archaeology-with-git/

Upvotes: 1

Related Questions