开发者

Git: Need cross-branch version number

开发者 https://www.devze.com 2023-03-29 16:15 出处:网络
I would like to generate a simple, increasing version integer, based on when a commit has changed a certain folder. And, I want

I would like to generate a simple, increasing version integer, based on when a commit has changed a certain folder. And, I want this version number to be valid across branches.

To illustrate, suppose the folder is named FOO, and it is on BRANCH1 and BRANCH2开发者_如何学C. Let's say version V is currently equal to 10.

1) make a commit that modifies FOO on BRANCH1: I would like V = 11 2) now make a commit that modifies FOO on BRANCH2: I would like V = 12

Any help would be greatly appreciated! Jacko


Branches are mere pointers on a graph.

git describe remains the only "label" valid across repos.
This question has an example where git describe is used to generate a "Vxxx".

You also have git name-rev if you want a "label" relative to a branch (but not valid across repos).

0

精彩评论

暂无评论...
验证码 换一张
取 消