I need to write an autoupdate script for our project. I have everything, except that I can't determine the name of the latest received tag. I tried with git describe, but it tells me the latest checked out tag. I don't need that of course, I have to get the nex开发者_开发技巧t reachable tag to checkout. Any idea?
Try this:
git describe --tags --abbrev=0 branch_name
to retrieve the name of the latest tag searching back from the tip of the desired branch, rather than HEAD (the current checkout).
That is, if your auto-update script has fetched origin master, you can do
git describe --tags --abbrev=0 origin/master
Note: --abbrev=0 makes describe return only the tag name, without a sha1 at the end. --tags makes describe return the latest annotated or unannotated tag. See git-describe(1) for a full discussion of the possible options.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论