Detach a child that has children

‘go’ is a gameobject that has a child and parent. I want to detach its parent but keep the relationship with the child in it.
I’ve tried
go.transform.parent = null;
It seems to detach the parent and the child either. How can I do this?

Problem solved!