MeloS
MeloS

Reputation: 7938

Git: assign version number to git submodule

How do you assign a version number to git submodule?
When using git submodule to list my submodules, I see a version number printed after some of the submodules like this:

2ac913c37058b9bd49f87953a7968a4aa9705f47 PAPreferences (0.4) 

How to configure my git repository so that my repository can also show a version number when being used as a submodule?

Upvotes: 3

Views: 63

Answers (1)

Chris
Chris

Reputation: 136936

That's a tag. You can confirm this by observing that the PAPreferences repository currently has four tags, including 0.4 on revision 2ac913c.

To tag your own repository, run git tag -a <tag> <commit>. In the above case, <tag> would have been 0.4 and <commit> would have been 2ac913c, or possibly the name of a branch whose tip pointed at 2ac913c at the time the tag was created. You can omit <commit> if you simply want to tag HEAD.

You will be prompted for a commit message.

Like most things in Git, your new tag is local until you push it. To push tags, after your normal push you should run git push --tags.

Upvotes: 2

Related Questions