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?
That's quite alright, the issue was tagged accordingly. Thanks.
\nThat's a great finding! I did do some searching to come up with the following.
\nHEAD
to point to the tag: repo.head.set_reference(repo.tags[tag].commit
repo.git.checkout(tag)
which does exactly what you want.I hope this answers the question - GitPython is a lot of 'low-level' plumbing, which makes some common operations unintuitive. These are best left to the git porcelain, provided by the git
command-line interface.
Even though I am closing the issue, please feel free to keep posting follow-ups.
","upvoteCount":1,"url":"https://github.com/gitpython-developers/GitPython/discussions/1157#discussioncomment-408811"}}}-
More a general Q/A than an issue, but I'm struggling with this topic. I clone a repository using I found the following solution, but it resets HEAD of my master branch, which is not what I want:
Is it possible to perform something like a |
Beta Was this translation helpful? Give feedback.
-
That's quite alright, the issue was tagged accordingly. Thanks. That's a great finding! I did do some searching to come up with the following.
I hope this answers the question - GitPython is a lot of 'low-level' plumbing, which makes some common operations unintuitive. These are best left to the git porcelain, provided by the Even though I am closing the issue, please feel free to keep posting follow-ups. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the reply. Your solution does exactly what I expected, and I was pretty sure that there is a possibility :-) Thanks! |
Beta Was this translation helpful? Give feedback.
That's quite alright, the issue was tagged accordingly. Thanks.
That's a great finding! I did do some searching to come up with the following.
HEAD
to point to the tag:repo.head.set_reference(repo.tags[tag].commit
repo.git.checkout(tag)
which does exactly what you want.I hope this answers the question - GitPython is a lot of 'low-level' plumbing, which makes some common operations unintuitive. These are best left to the git porcelain, provided by the
git
command-line interface.Even though I am closing the issue, please feel free to keep posting follow-ups.