Skip to content

Can't check out a different branch on a submodule #26818

Answered by aormsby
aormsby asked this question in Actions
Discussion options

You must be logged in to vote

Okay, I’ve got it! The original solution I marked got me really close to the right functionality, but there were still some issues coming through. However, I want to thank @weide-zhou for their help. I couldn’t have come to these solutions without the push. :slight_smile:

The Underlying Problem

The git refspec for the submodules wasn’t configured to track any remote refs outside ‘master’ so I could never get the other remote refs to other branches.

Incorrect config:

[remote "origin"]
	fetch = +refs/heads/master:refs/remotes/origin/master
# tied to master refs only

Config that gets all refs:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
# gets all refs - *

The checkout a…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants