Codespaces opens master branch by default?

I’ve added Codespaces on a repository that had a Master branch, but that branch got deleted and I’m now using only the Main branch. Codespaces still opens the master branch, even though that branch is no longer available see:

Seems like I have created the Codespace while the branch was still available. After deleting the Codespace and creating a new, uses the new branch.

Is it picking up the default branch or the branch you are currently in?

Codespaces persists your git state similar to your local machine, so if you have a branch in your codespace that is deleted in your repo, it won’t be deleted in your codespace by default. If you were to fetch, the main branch should be available in this scenario.

When you create a codespace from, it will use the default branch. If you create a codespace from the repo view or PR, it will start from the ref that you are currently viewing (so if you’re viewing branch foo on a repo, it will create a codespace off that branch). You can always switch branches in a codespace, so you aren’t tied to the branch you currently created a codespace from.

Thanks! That was not that clear for me :-). Was expecting a new container each time, although persisting the storage/environment does make life easier. Small mindset shift to make :grin: