Emacs-VersionControl

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Version Control Within Emacs[edit]

IMPORTANT NOTE[edit]

In order to use these commands with a remote repository, it's best to cache your credentials. On the command line, execute:

git config --global credential.helper 'store --file ~/.git-credentials' 
git config --global credential.useHttpPath true

In order to squelch the warning that occurs while pushing, execute:

git config --global push.default matching

Finally, set up your email address and username:

git config --global user.email "email@example.com"
git config --global user.name "John Doe"

Useful Commands[edit]

  • Add file to version control : vc-register -- add a new file to version control
    • C-x v i (last character is a lower-case I)
  • Compare current version with repository : vc-diff -- diff with other revisions
    • C-x v =
  • Get latest version (pull) : vc-update -- Get latest changes from version control
    • C-x v +
  • Push latest changes to remote repository : vc-push
    • C-x v P
  • Show log : vc-print-log -- show log
    • C-x v l (last character is a lower-case L)
  • Show status : vc-directory -- show all files which are not up to date
    • C-x v d
    • While in this buffer, use:
      • p to move to previous entry
      • n to move to next entry
      • m to mark an entry
      • u to unmark an entry
      • x to hide files which are up-to-date or ignored
      • q quit the buffer
  • Perform the next "logical" action : vc-next-action
    • C-x v v
  • Revert buffer : vc-revert-buffer -- undo checkout
    • C-x v u
  • Remind me what does what?
    • C-x v ?

During a Merge[edit]

  • C-c ^ n to move to the next conflict
  • C-c ^ p to move to the previous conflict
  • C-c ^ m to keep your version (usually displayed in purple)
  • C-c ^ o to keep the other version (usually displayed in cyan)