Include last commit index in project

倖福魔咒の 提交于 2019-12-12 02:44:19

问题


I'm working on a game project in Uninty with some friends, and since we're going to make each one his own branches i would like to include in the project some of the versioning info, e.g. to get track of the current build beeing tested, so i've tought to the current branch and commit index.

When i say "include in the project" i mean to display those info somwhere in the ui during gameplay. I would like to do so to avoid using "custom version number" like ver.0.1.2 etc, because those versioning number are totally arbitrary and must be manually updated during development, while branches and commit are indipendent and automatic.

I'm currently working with SourceTree, so when i say "comomit index" i mean the short descriptor displayed in SourceTree under the Commit column, like in linked figure. I've looked into the .git folder but i couldn't find the info I need.

Mine could not be the best idea ever, so i'm open to suggestion to get a unique identifier for the current build.

Anyone can help?

p.s.: i think my question is independent from the repository, the versioning software and the project itself, i'm not looking for a better versioning software or custom Unity solution.


回答1:


Get the last tag in the branch: git describe --abbrev=0 --tags

Get the last commit's abbreviated id: git log -1 --format=%h; full commit id: git log -1 --format=%H.

Get the last commit's subject (first line): git log -1 --format=%s.

See git help log for the full list of available placeholders.



来源:https://stackoverflow.com/questions/44451819/include-last-commit-index-in-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!