git-tag

git describe: inexplicable commit count

心不动则不痛 提交于 2019-12-11 03:52:27
问题 Consider this excerpt of git log --oneline --decorate --graph : * 552485a (HEAD -> master, origin/master) Finish v0.8.4 |\ | * c198066 (tag: v0.8.4) some commit message * | 343af72 Finish v0.8.3 |\ \ | |/ | * 0267e30 (tag: v0.8.3) some commit message * | 8f0ff57 some commit message |\ \ | |/ ... (NB: the tag v0.8.4 is on a commit from branch 'develop') How comes that when I run git describe I get this: v0.8.4-16-g552485a that is, git counts 16 commits since tag v0.8.4. I'd expect it to return

`type commit` in an annotated tag in git

允我心安 提交于 2019-12-11 01:58:54
问题 Echoing an annotated tag in git with git cat-file -p <hash-of-tag> produces something like this: object <sha1-hash> type commit tag 0.0.1 tagger My Name (...) Description of tag object points to a commit object in my case. type commit implies this mustn't be the case necessarily. Are there cases where annotated tags don't point to commits? 回答1: Yes: an annotated tag object can point to another annotated tag object, or even directly to a tree or blob. These are all fairly rare though. The git

Git describe fails to return most recent annotated tag

六眼飞鱼酱① 提交于 2019-12-10 23:09:58
问题 I wrote a function that uses git annotated tags to create new releases and/or bump semver style version numbers for my project. I am in the process of adding unit tests and noticed that git describe --abbrev=0 fails to retrieve the most recent tag, only when several git tag -a <tag> -m <msg> are run in a sequence. I thought this has to do with these tags being created for the same commit, but I think that should not be the case for annotated tags. Expected behavior: git tag 1 -m v1; sleep 1;

Get latest git tag from the current commit

落花浮王杯 提交于 2019-12-10 14:14:10
问题 I am trying to get the latest git tag from a certain point in my tree. The tree looks as follows: * 334322c|2016-12-06| (tag: 0.1265, tag: 0.1264) (18 hours ago) * 739392e|2016-12-06| (HEAD -> testbranch, tag: 0.1263, tag: 0.1262) (19 hours ago) * 8ec1add|2016-12-06| (tag: 0.1261, tag: 0.1260, tag: 0.1259) (20 hours ago) * 5b2667b|2016-12-06| (tag: 0.1258) (21 hours ago) * c7ff4bc|2016-12-06| (tag: 0.1257, tag: 0.1256) (22 hours ago) 0.1263 is the git tag I am looking for. When on 739392e

git pre-push hook, don't run if is --tags

拟墨画扇 提交于 2019-12-10 13:37:01
问题 I have a prepush hook that tests my code, however, it also runs when I do a git push --tags . Is there any way to avoid this? Maybe there's some way to check if its a regular push or if its a --tags push? Update - These are the only arguments I was able to find: $1 is the name of the remote $2 is url to which the push is being done 回答1: I have a solution to this, but it's really kludgey. A while back, I set up a pre-commit hook to stop me from accidentally using -a when I have files staged.

Seeing what revision goes with a tag in Git

孤者浪人 提交于 2019-12-10 12:31:37
问题 Beginner Git question: In the Mercurial world, hg tags gives me a list of tags and the corresponding revisions, whereas git tag only lists the tag names. How do I see what the matching rev number/hash is? 回答1: For full information associated with that tag, use command git show v1.5 Or you can see the lightweight information, skipping details, by command git show v1.5 -lw 回答2: If tag in question is so called 'heavyweight tag', or annotated tag, utilizing tag object, e.g. PGP signed version (as

git pull - will it fetch tags on remote by default?

偶尔善良 提交于 2019-12-10 11:26:36
问题 I know git fetch --tags will fetch all tags from remote to local. I am not sure will git pull get tags from remote by default, so will it or not? 回答1: It should, since git pull does a git fetch and a git merge. But it will do so only from git 1.9.0+, as I mentioned in "Does “git fetch --tags” include “git fetch”?". 回答2: A git pull will by default only fetch tags that are reachable by the objects that are fetched. From the git pull documentation --no-tags By default, tags that point at objects

How to git tag all submodules?

偶尔善良 提交于 2019-12-09 10:57:12
问题 I would like to tag all of the submodules of my project. I tried to do that with: git submodule foreach git tag tagName ... but it appears to just return with no errors, having done nothing. Edit: Here are the results of my attempt: Can someone tell me how to properly tag all submodules? Note: this a very similar question to this post, but the answer for that one suggested to rely on the submodule refs in the super-project. I, however, would actually like a tag in the submodule's repo. 回答1:

Automatically run Git hook when creating a Git tag

左心房为你撑大大i 提交于 2019-12-08 17:26:38
问题 Is there a Git hook which can be executed when a new Git tag is added? Because I want to automatically write new Git tag names into a textfile. Do you have a clue on how to do this? 回答1: While it's not currently possible using hooks, you can always create a simple script. mytag.sh : #!/bin/sh [ -z "$1" ] || ( git tag $1 && git tag > /path/to/your-tags-file ) then : chmod +x mytag.sh git config alias.mytag !/path/to/mytag.sh 来源: https://stackoverflow.com/questions/4309759/automatically-run-git

Print the message of a git tag

徘徊边缘 提交于 2019-12-08 17:15:30
问题 I need a git command that would output only the message of a given annotated tag. It's almost possible with git tag -ln : $ git tag -ln v1.3.7 v1.3.7 Here be annotations It's just that I don't want the tag and whitespace in the beginning, and throwing a regex at this feels like overkill. Is there any built-in flag i could use? I'm using git version 1.8.3.2. Some of the answers at Print commit message of a given commit in git use git show --format=%B . I can't seem to restrict output to only