How to know if a tag is a fast foward to another in a BARE repository?
We want to make a build validation, we want to make sure the new version has all commits from the previous one. We are tagging each new version.
We are using: git merge nextversiontag –no-commit –ff-only, but this command works only on a full repository. Team City 8 clones a bare repository.
- TeamCity agent error “failed to perform checkout on agent”
- Setting up CI with TeamCity with Git & NAnt
- TeamCity prevent simultaneous branch builds
- Extracting git hash and use it in gradle
- TeamCity, how to get names of the files edited
- TeamCity for static site
One Solution collect form web for “How to know if a tag is a fast foward to another in a BARE repository?”
If all you want to know is whether you can fast-forward from one tag to another, then that’s just simply asking the question: “Is the old tag reachable from the new tag by following parent-references along the commit graph?”
You can answer that question by using the following:
git merge-base --is-ancestor <old-tag> <new-tag>; echo $?
If the output is
0, then the old tag is reachable from the new tag, and if it’s
1, then it’s not.
$? is Bash syntax for the error code of the last command.
If you were planning on doing something else for your build validation, then you’ll need to update your question to clarify what it is that you were planning to do.