![]() Script that sort tags according to date of merge base between HEAD and tag: $ git tag \Įcho `git log -n 1 $b -format=%ai` $t \ I don't know how to calculate length of shortest path. number of revs that reachable from HEAD but not reachable from tag. ![]() date of merge base between HEAD and tag.length of shortest path from HEAD to merge base with tag.What is nearest tag in the past with respect to branching in Git?Ĭurrently I have 4 reasonable definition of distance between tag and revision with decreasing of usefulness: I start my own journey in (look inside, I didn't copy fancy proof images to this long post): Naturally as project maintainer you don't want to garbage your mainline diff history with useless binary blobs and perform commit of build artifacts out of mainline.īecause Git uses DAG and not linear history - it is hard to define distance metric so we can say - oh that rev is most nearest to my HEAD! For user conventions they carry binary/minified release files in DVCS. Just look to any well established JS/CSS projects. Todays many project perform releases (and so tagging) in separate branch from mainline. Just run any command supplied by other on jQuery Git history when you at different point of history and check result with visual tagging history representation (I did that is why you see this post): $ git log -graph -all -decorate -oneline -simplify-by-decoration What is wrong with all suggestions (except Matthew Brett explanation, up to date of this answer post)? See git-config(1).Īfter google, someone said git 2.8.0 support following syntax. It will use lexicorgraphic order by default, if tag.sort property doesn't exist.ĭefaults to the value configured for the tag.sort variable if itĮxists, or lexicographic order otherwise. ![]() With git tag -help, about the sort argument. Tail -n # display the last part of a file Multiple patterns may be given if any of them The pattern is a shell wildcard (i.e., matched usingįnmatch(3)). Running "git tag" without arguments also listsĪll tags. List tags with names that match the given pattern (or all if no More info git tag -help # Help for `git tag` So, those tags with first char a-z will be ignored. Get the last tag, whose first char is 0-9. Other tags named 1.0.0, 1.1.0 will be ignored. For example, tag named with ac1.0.0, or ac1.0.5. It will therefore not find tags like v0.2 that are not on the path back from HEAD, but a path that diverged from there. In git terms, git describe looks for tags that are "reachable" from HEAD. Git describe does something slightly different, in that it tracks back from (e.g.) HEAD to find the first tag that is on a path back in the history from HEAD. Here's a Python script that does that by iterating through all the tags running this check, and then printing out the tag with fewest commits on HEAD since the tag path diverged: This gives you the number of commits on HEAD since the path ending at v0.2 diverged from the path followed by HEAD. You can find that out by using git log v0.2.HEAD etc for each tag. I think you usually want this second answer, closer in development history. v0.1 is the more recent, but v0.2 is closer in development history to HEAD, in the sense that the path it is on starts at a point closer to HEAD. Imagine the developer tag'ed Z as v0.2 on Monday, and then tag'ed Q as v0.1 on Tuesday. These might be different of course: A->B->C->D->E->F (HEAD) In your question, this would return tag a. ![]() Or you could mean "which tag is the closest in development history to some named branch", usually the branch you are on, HEAD. In terms of your question, you would want to return tag c. You could mean, "which tag has the creation date latest in time", and most of the answers here are for that question. "Most recent" could have two meanings in terms of git.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |