bug fix, caused by typo
reconstruct the front-side  commit function, add commitBranch and commitMerge
fix bugs caused by typo and inconsistent duplicated code