dm: git: check repo status at last

Do not check after every commit.
dm: work around on zero sized file

I don't know why, but it happened... The source file is fine, but
shutil.copyfile() returnd zero sized file, dam...