Issue
I'm writing a shell script and I'm looking to checkout the latest version of repo. Specifically I want to break this process apart into multiple steps.
- I want to save the repositories latest tag into a variable
- Print out
Checking out version: XX
- Checkout the latest tag
I've seen similar questions but I don't see how to save the name of the tag into a variable (probably because I'm a noob with shell scripts).
Solution
git describe --tags
should give you info.
bash/ shell script:
#!/bin/bash
...
latesttag=$(git describe --tags)
echo checking out ${latesttag}
git checkout ${latesttag}
Answered By - exussum Answer Checked By - Mary Flores (WPSolving Volunteer)