Codespaces opens master branch by default? #26009
-
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: https://github.com/rajbos/azure-devops-marketplace-extension-news/branches 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? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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 |
Beta Was this translation helpful? Give feedback.
-
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 😁 |
Beta Was this translation helpful? Give feedback.
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
github.com/codespaces
, 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 branchfoo
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.