IDEX-777 : introduce a flag to keep only a directory after a checkout

It needs to be discussed before trying to merge it