If you're familiar with the version control tool git but still haven't mastered it fully, this post is for you. Every once in a while when you update your local repository with git pull, a merge conflict will occur. git will automatically try to merge the new files with the existing ones, but it likes to play it safe so it will create a new commit and ask you to "enter a commit message to explain why this merge is necessary".

The way it does this can be a bit off-putting for novices like me, because on Linux it will usually open vi, the venerable old text editor of ages past. Navigating vi can be cumbersome, but here is the step-by-step on how to use it to enter a merge message:

  1. Press i. This will put vi into write mode.
  2. Enter your merge message (i.e. "merge from upstream")
  3. Press Escape, followed by :wq

Simple as that!

This guide is based on this thread on Stack Overflow.