cmd_history: use check_commit to prepare the index