common work for git checkout

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>