How VC Helps with Basic Operations

Historically, you had to know three or four different shell commands to do the basic operations of version control (registration, check in, check out, and revert), and you had to do each one outside your editor (or at best in a subshell of your editor). This procedure was complicated and annoying, and a lot of people simply didn’t bother.

VC’s interface is much simpler. The simplicity comes from noticing that whatever state your version-controlled file is in, there is normally just one logical thing to do next. Here are the rules:

  • If your file isn’t under version control, the next logical thing to do is register it and check out a modifiable copy for you.

  • If it’s registered, but not checked out by anyone, the next thing you generally want to do is check it out so you can edit it.

  • If you have it checked out, the next logical thing is to check it back in.

  • If someone else has it checked out, you may want to steal the lock (notifying the lock owner that you’ve done so).

Indeed, there is just one basic command in VC mode: C-x v v (for vc-next-action), which you can think of as “do the next logical thing to this file” or, more precisely: “take the currently visited file to the next normal version control state.” It follows the arrows in Figure 15-1, which describes the normal version control cycle. [90]This command is available in every Emacs 19; when you invoke it, it automatically fetches the rest of VC and does its job.

Figure 16-1. The normal version ...

Get Learning GNU Emacs, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.