shellstreak

Cancel a merge with conflicts

Safe: nothing is lost

Short answer

Run git merge --abort. The merge stops and your files go back to how they were before you started it.

The commands, one by one

  1. 1git status

    Shows you're in the middle of a merge, with the conflicted files under Unmerged paths.

  2. 2git merge --abort

    Cancels the merge: conflict markers and half-merged files are gone, and the branch is untouched.

Try it safely

Merging prices stopped with a conflict in scones.txt, and you need to ask the team first.

learner@shellstreak: ~
Starting your practice shell…

Type your own commands too. Reset puts the repository back to just after the mistake.

Practise this in 5 minutes

Lesson 60, Merge conflicts, walks you through this undo and the ones around it in a safe terminal, step by step, and checks your answers.

Keep the terminal cheat sheet handy: free to print

Get the shellstreak newsletter

Short terminal and Git tips you can try in a minute, plus a heads-up when new free tools and lessons ship. It lands now and then, never a flood.

No spam, unsubscribe in one click.