bash-scripts icon indicating copy to clipboard operation
bash-scripts copied to clipboard

git_sparse_checkout using a branch tag

Open jedwards4b opened this issue 1 year ago • 1 comments

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.

jedwards4b avatar Dec 28 '23 15:12 jedwards4b

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.

jedwards4b avatar Dec 28 '23 16:12 jedwards4b