简体   繁体   English

在项目中包括最后提交索引

[英]Include last commit index in project

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, eg to get track of the current build beeing tested, so i've tought to the current branch and commit index. 我正在与一些朋友一起在Uninty中开发一个游戏项目,由于我们要使每个人都有自己的分支机构,因此我希望在项目中包含一些版本控制信息,例如以跟踪当前的构建环境。经过测试,因此我对当前的分支和提交索引有所了解。

When i say "include in the project" i mean to display those info somwhere in the ui during gameplay. 当我说“包括在项目中”时,我的意思是在玩游戏时将这些信息显示在ui中。 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. 我这样做是为了避免使用像版本0.1.2之类的“自定义版本号”,因为这些版本号完全是任意的,并且必须在开发期间手动更新,而分支和提交则是独立且自动的。

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 . 我当前正在使用SourceTree,所以当我说“ comomit index”时,是指在SourceTree中的Commit列下显示的简短描述符,如链接图中所示 I've looked into the .git folder but i couldn't find the info I need. 我已经查看了.git文件夹,但找不到所需的信息。

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? 有人可以帮忙吗?

ps: 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. ps:我认为我的问题独立于存储库,版本控制软件和项目本身,我不是在寻找更好的版本控制软件或自定义Unity解决方案。

Get the last tag in the branch: git describe --abbrev=0 --tags 获取分支中的最后一个标签: git describe --abbrev=0 --tags

Get the last commit's abbreviated id: git log -1 --format=%h ; 获取最后一次提交的缩写ID: git log -1 --format=%h ; full commit id: git log -1 --format=%H . 完整的提交ID: git log -1 --format=%H

Get the last commit's subject (first line): git log -1 --format=%s . 获取最后一次提交的主题(第一行): git log -1 --format=%s

See git help log for the full list of available placeholders. 有关可用占位符的完整列表,请参见git help log

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM