Emacs/emacs/VC-With-A-Merging-VCS

From Get docs

28.1.3.1 Basic Version Control with Merging

On a merging-based version control system (i.e., most modern ones; see VCS Merging), C-x v v does the following:

  • If there is more than one file in the VC fileset and the files have inconsistent version control statuses, signal an error. (Note, however, that a fileset is allowed to include both newly-added files and modified files; see Registering.)
  • If none of the files in the VC fileset are registered with a version control system, register the VC fileset, i.e., place it under version control. See Registering. If Emacs cannot find a system to register under, it prompts for a repository type, creates a new repository, and registers the VC fileset with it.
  • If every work file in the VC fileset is unchanged, do nothing.
  • If every work file in the VC fileset has been modified, commit the changes. To do this, Emacs pops up a *vc-log* buffer; type the desired log entry for the new revision, followed by C-c C-c to commit. See Log Buffer.

    If committing to a shared repository, the commit may fail if the repository has been changed since your last update. In that case, you must perform an update before trying again. On a decentralized version control system, use C-x v + (see Pulling / Pushing) or C-x v m (see Merging). On a centralized version control system, type C-x v v again to merge in the repository changes.

  • Finally, if you are using a centralized version control system, check if each work file in the VC fileset is up-to-date. If any file has been changed in the repository, offer to update it.

These rules also apply when you use RCS in its non-locking mode, except that changes are not automatically merged from the repository. Nothing informs you if another user has committed changes in the same file since you began editing it; when you commit your revision, that other user’s changes are removed (however, they remain in the repository and are thus not irrevocably lost). Therefore, you must verify that the current revision is unchanged before committing your changes. In addition, locking is possible with RCS even in this mode: C-x v v with an unmodified file locks the file, just as it does with RCS in its normal locking mode (see VC With A Locking VCS).