← 返回首页
How to get the hash of the most recent commit of a file under a ref? · gitpython-developers/GitPython · Discussion #1949 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus
Discussion options

{{title}}

1 You must be logged in to vote
All reactions

The algorithm can't be used - instead one should traverse each commit, see which files were changed, and remove those from the set of all currently tracked files while associating the hash of the commit. Repeat until the set of tracked files is empty.

This will traverse the commit-graph once, in the worst case, and diff the trees of each commit. But there isn't really any other way.

Replies: 1 comment

Comment options

{{title}}

Marked as answer
1 You must be logged in to vote
All reactions
0 replies
Answer selected by ali1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu

Select a reply

Loading
👍 1 reacted with thumbs up emoji 👎 1 reacted with thumbs down emoji 😄 1 reacted with laugh emoji 🎉 1 reacted with hooray emoji 😕 1 reacted with confused emoji ❤️ 1 reacted with heart emoji 🚀 1 reacted with rocket emoji 👀 1 reacted with eyes emoji

Footer

© 2026 GitHub, Inc.