just make sure the Galileo board firmware and the SD-Card Linux Image are the latest one.
For my Galileo Gen 2 board, the firmware is version 1.0.4 and the SD-Card's image is SDCard1.0.4. (Notice the version numbers are the same!)
The SD-Card image can be downloaded from Galileo Software Downloads
Do not use the LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.7.7z image because it won't work on Gen 2 boards.
Sketch will be save in SD card when you upload the sketch to Gen 2 board using micro USB cable.
Remove micro USB cable follows by power down the power adapter.
Power on the Gen 2 board. Wait for about 2 minutes for Galileo to boot up and load the saved sketch.
The micro USB can connect and disconnect without any issue.