Manage Edit Post Logout Login

Technical Notes

Documentation of fixes for programming/computing annoyances.

« Back to blog

Python: Get git hash for the last commit modifying the current folder

from os import path
p = path.dirname(path.abspath(__file__))
hash = subprocess.check_output(["git", "rev-list", "-1", "HEAD", "./"], cwd=p).strip()

🌟 Was this page helpful? Please let me know with this quick, 3 question survey.

Upvote Upvoted 0
Tweet
Like this post?
Subscribe by email
You're following this blog. Unfollow
Follow this Posthaven
Enter your email address to get email alerts about new posts on this site. Unsubscribe anytime.
Email address is invalid.
0 responses
Add Website URL »

by Max Masnick

www.maxmasnick.com

Follow @_technotes on Twitter

Terms of use.
Posted

Tags

  • python