Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combined command for git tag verification and git checkout?

Usual work flow is, git tag verify.

git tag -v tagname

Then git tag checkout.

git checkout tagname

Is there a combined command to verify the tag, shows the verification, and checks it out if verification succeeded?

like image 306
adrelanos Avatar asked Sep 22 '14 02:09

adrelanos


1 Answers

In a bash shell:

git tag -v tagname && git checkout tagname

That would only work if the first command succeeds.

That can be part, for instance, of a post-receive hook.
Or it can be made an independent command:

Even on windows, a script name git-ctag (put anywhere in the %PATH%) would enable you to type git ctag <atag>, which would checkout the tag only if the verification step passes.

#!/bin/bash
git tag -v $1 && git checkout $1
like image 102
VonC Avatar answered Oct 19 '22 23:10

VonC