Git: Need cross-branch version number
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).
精彩评论