Problems with detached heads due to shallow clones

I had some issues with merges on detached heads due to not being aware of shallow cloned repositories I want to share.

I have a project, where branches can be very long on merge due to lots of commits from the translation system. It occurred to me that git gave me an error like this: "refusing to merge unrelated histories"., when I tried to merge two branches in the same repo.

I was not aware, that Gitpod changed to shallow cloning and I was thinking the translation system was the root cause for this problem, so I hard merged. A similar problem occurred in a different project, but there was no third party system involved. When checking the history, I discovered lots of commits were missing and the repo is only a shallow and not a full clone any more.

To fix this just unshallow the repo by running

git fetch --unshallow

in the terminal.

As I saw on the PR on github this is a preview feature. So it should only happen if you have preview enabled. -

There are also already issues / PRs for unshallow when workspace is ready (after prebuild) Unshallow repo after workspace is ready by jeanp413 · Pull Request #6857 · gitpod-io/gitpod · GitHub
And about the breaking of merge, rebase & git extensions. shallow clone breaks git rebase, gitlens, timeline and other features · Issue #6796 · gitpod-io/gitpod · GitHub

Sorry that we did not communicate it. It would be good indeed to document and add to changelog. We do shallow clone during workspace startup and then we will unshallow it in background for regular workspaces, but not prebuilds.