Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get current tag of branch and increment patch version
import git
git_path = '/path/to/git_dir/'
repo = git.Repo(git_path)
cur_version = repo.git.describe()
major, minor, patch = cur_version.split('.')
updated_patch = int(patch)+1
new_tag = '.'.join((major, minor, str(updated_patch)))

This comment has been minimized.

Copy link
Owner Author

gnilchee commented Jan 21, 2018

~/git_dir# git describe --tags
root@2ed8ca477170:~# python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.