bash-scripts
bash-scripts copied to clipboard
git_sparse_checkout using a branch tag
If I try to use a branch tag in the git_sparse_checkout script I get an error in the checkout step: error: pathspec 'branch_tag_name' did not match any file(s) known to git
I found that if I use the branch instead of the branchtag and then add additional commands: git -C /path/to/submodule fetch -t -depth=1 git -C /path/to/submodule checkout branchtag
It will do what I need it to do, however I think that the fetch command could be improved to get less.
This didn't work for a submodule that was referenced by hash instead of branchtag.
However I found that replacing both the additional commands with
git restore submodulename
gives what I want to happen.