Search code examples
gitgit-subtreegit-tag

checkout a specific tag with git subtree


Can I use tags in subtrees? Following a specific issue:

I have a git repository which includes an external repository as a subtree. I could add this external repository and checkout a specific branch from this repo. With git subtree pull --prefix=<dir> --squash <remote> <branch> the update from the selected branch works well.

Now is it possible to checkout a specific tag? I couldn't find some information about tags in subtrees...


Solution

  • Actually any reference should work. The man page for subtree displays this.

    git subtree pull  -P <prefix> <repository> <ref>
    

    Where <ref> can be a SHA, tag or branch. Basically anything git can resolve to a commit.