We've been using python to automate some git work for quite some time in my group, and everything has worked fine. Unfortunately, I've come across something I would like to use, but doesn't work when put into a python subprocess. Here's the command:
git describe --tags `git rev-list --tags --max-count=1`
When I use it in my git bash (we're using Windows) it works fine, but when I put it in a python subprocess, it complains that git rev-list --tags --max-count=1
is not a valid command. I was wondering if anyone could enlighten me as to why, and preferably, a way of using it. I got the line from this question:
How to get the latest tag name in current branch in Git?
I'm trying to get the LATEST tag on a branch, that is closest to the current HEAD. I've got a hacky workaround right now that lists all of the tags and then sorts them numerically, but that's only working because we haven't put out any non-numeric tags, which won't necessarily be the case always.
Can anyone please help me?