To obtain the hash of the most recent git commit of a Python package, follow these steps:
git log -n 1
. This will display the details of the most recent commit, including the hash.Alternatively, if you have the package installed locally on your machine and want to obtain the hash of the most recent commit of the installed version, you can run the following command in your terminal or command prompt:
pip show <package_name> | grep Version | awk '{print $2}' | xargs -I {} sh -c "echo {}; cat /path/to/site-packages/<package_name>.egg-info/GITSHA"
Replace <package_name>
with the name of the Python package you want to obtain the hash for and replace /path/to/site-packages/
with the path to the directory where the package is installed on your machine. This command will display the version of the installed package followed by the hash of the most recent git commit.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-07-10 10:16:17 +0000
Seen: 12 times
Last updated: Jul 10 '23
Can you extract certain values located between columns in two separate csv files using Grep?
How can I only get the Column with the Filename from a ls -all output with Awk?
How can the number of backslashes be doubled using various versions of `awk`?
Why is awk -i inplace not functioning properly when used within a script?
How can a customized trigger be established for RabbitMQ queues in Zabbix?
What is the Grep command that can be used to extract a section of the last line?
How can you print a range of columns in awk using a variable?
How can we use Bash to identify the directory that has been around the longest?