Saving git log number of the current commit in MATLAB
古いコメントを表示
I wanted to save the current git commit hash of the code that I am currently running. Ideally, something like:
git_hash_string = get_current_git_hash()
dips(git_hash_string)
and then have it written to some file or displayed to the matlab command line. Is that possible?
採用された回答
その他の回答 (1 件)
men8th
2023 年 3 月 3 日
If you are wanting to get a build number then I find the following works well:
system("git describe --tags --first-parent --abbrev=7 --long --dirty --always")
This will return the most recent tag in the repo, followed by the commit hash. I then write this to a file and append with a timestamp. You can then read the value from the file to get a build ID for your toolbox or similar, which can be displayed with the output.
Build: 1.0-4-gb52160e 03-Mar-2023 12:58:39
カテゴリ
ヘルプ センター および File Exchange で Source Control についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!