I am thinking about using git describe
to generate automated version numbers. As suggest here.
My question is that if I get o/p of git describe
as v2.0-64-g835c907
,
how can I checkout that particular revision number using git in future?
Solution 1: Use the git checkout command 1. Checkout to the branch where you want to copy the file. 2. Once you are on the correct branch, copy the file.
In Git, the term checkout is used for the act of switching between different versions of a target entity. The git checkout command is used to switch between branches in a repository. Be careful with your staged files and commits when switching between branches.
To checkout a previous commit, you will use the Git checkout command followed by the commit hash you retrieved from your Git log.
You can just do
git checkout v2.0-64-g835c907
The output from git describe can be used as a reference to a commit itself
If I understand correctly this may be what you want:
git checkout `git describe`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With