checkout and commit to ensure everything goes well