how to exit git after merge code example Example 1: git stop merge git reset --hard HEAD Example 2: cancel a merge git git merge --abort