git clone release
You can do this with the --branch flag, which will also accept a tag.
$ git clone [email protected]:mygitname/theproject.git --branch 1.0.2
In most cases, you will just want to checkout the tag as described in Exprator's answer.
0
2
# One-liner to get link to the source archive of latest release
curl -s https://github.com/USER/REPO/releases |
grep -m1 -Eo "archive/refs/tags/[^/]+\.tar\.gz" |
xargs printf "https://github.com/USER/REPO/%s"
# Command to clone the source of latest release to the current folder
# w/o downloading archive to local disk
ghRepoCloneLatestRelease ()
{
[[ ${1} =~ / ]] &&
wget -qO- https://github.com/${1}/$(curl -s https://github.com/${1}/releases |
grep -m1 -Eo "archive/refs/tags/[^/]+\.tar\.gz") |
tar --strip-components=1 -xzv >/dev/null
}
# Usage: ghRepoCloneLatestRelease user/repo
Thank you!
2
0
Are there any code examples left?
New code examples in category Shell/Bash
-
Shell/Bash 2022-03-27 22:30:33 wise highlight ubuntu
-
Shell/Bash 2022-03-27 22:25:19 how to send a pull request in git
-
Shell/Bash 2022-03-27 21:55:06 how to open terminal in sublime text ubuntu
-
Shell/Bash 2022-03-27 21:25:19 how to switch branch
-
Shell/Bash 2022-03-27 21:20:25 python
-
Shell/Bash 2022-03-27 21:20:04 set user as admin gitlab
-
Shell/Bash 2022-03-27 21:10:09 apache2 mod_jk proxy to tomcat connector
-
Shell/Bash 2022-03-27 20:35:12 chown
-
Shell/Bash 2022-03-27 20:15:08 awk last match