-
-
Notifications
You must be signed in to change notification settings - Fork 963
Closed
Labels
Description
More a general Q/A than an issue, but I'm struggling with this topic.
I clone a repository using Repo.clone_from(). Afterwards, I simply want to switch to a specified tag within the repository, similar to git checkout tags/<my_tag>.
I found the following solution, but it resets HEAD of my master branch, which is not what I want:
logging.info("Cloning repo... " + name)
repo = Repo.clone_from(url, path)
repo.head.reference = repo.tags[tag].commit
Is it possible to perform something like a git checkout tags/<my_tag> where I just switch to the current tag, but am able to switch also back to the current / latest commit on the repository?