1

I have read

https://www.emacswiki.org/emacs/VersionControl

https://www.emacswiki.org/emacs/RevisionControlSystem

but I'm missing something... What is the starting point? What do I need to install, if anything?

I read some mention of vc.el, but should I expect to find it in my distribution, or should I install some package?

I'm using v29.1.

balanga
  • 135
  • 6
  • 1
    vc.el is part of Emacs, so you should have it already. Note that it is a front-end only, so you will need to have an underlying VC system installed (git, bzr, mercurial, monotone are the more "modern" choices, but it also supports SCCS, RCS, CVS, Subversion etc). – NickD Oct 02 '23 at 22:46
  • C-h i g (emacs)Version Control – phils Oct 03 '23 at 08:13
  • Was I supposed to enter C-h i g (emacs)Version Control literally? Nothing came up. I'm unable to locate vc.el although C-x v v shows Searching for program: No such file or directory, rcs . Do I need to install rcs for this to work? – balanga Oct 04 '23 at 09:15
  • C-h i brings up the info reader, g prompts for an info node, and (emacs)Version Control at that prompt takes you directly to that node of the user manual. You can also type C-h r to get to the top level of that manual, and search for Version Control. If you're not seeing the manual and you're using Ubuntu or another Debian-based OS then you're probably suffering from https://emacs.stackexchange.com/questions/48211/emacs-manuals-are-missing-on-debian-ubuntu – phils Oct 04 '23 at 13:04
  • BTW, if your question is more "I've never used any version control system before, inside or outside of Emacs" then there's not any one single answer to "where to start" because there are many different VC tools, and a tutorial on even one of them is really outside of the scope of this Q&A. That said, a key benefit of vc.el is that it provides a similar UI for all the tools that it supports (but there are still differences, and ultimately it's very valuable to have a good understanding of the specific tool you're using). – phils Oct 04 '23 at 13:33
  • If that's the situation, then I recommend learning the basics of some VCS tool outside of Emacs first (i.e. follow some tutorials and get familiar with all of the most important shell commands), and then come back to vc.el (or perhaps Magit if you've decided to stick with Git) and see how the Emacs UI works. – phils Oct 04 '23 at 13:36

1 Answers1

2

I have read https://www.emacswiki.org/emacs/VersionControl https://www.emacswiki.org/emacs/RevisionControlSystem

There are many useful tips under those pages but this may not be the best place to start: firstly because many of those posts on the wiki are about topics such as custom keybindings or changing coloring - this will be useful later. Secondly, the pages cover version control systems such as RCS (Revision Control System), SVN and others that aren't as popular nowadays as Git which I assume is what you want to focus on first.

Two easy ways of interacting with Git in Emacs would be:

  1. Simply open a terminal window for the project you want to enable VC for and execute your git commands there (git init, git add ., etc.) - like you could do if you worked in other editor or IDE - this makes it a bit more convenient as you also have you terminal in Emacs, in another window, next to your code. You may find this useful: https://www.gnu.org/software/emacs/manual/html_node/emacs/Shell.html and https://www.masteringemacs.org/article/running-shells-in-emacs-overview

  2. magit - which is "an interface to the version control system Git" which "allows even experienced Git users to perform almost all of their daily version control tasks directly from within Emacs". It's worth learning Emacs just for this package. :) It's not included in Emacs by default so you need to install it as a package. Installation instructions are here: https://magit.vc/manual/magit/Installing-from-Melpa.html

What do I need to install, if anything? I read some mention of vc.el, but should I expect to find it in my distribution, or should I install some package?

vc.el is included in Emacs. In general, you can discover if something is a built-in package or not by M-x describe-package and entering what you suspect is the package name (so if you come across something likevc.el, search for vc - without the suffix. If you do not remember installing anything but when you run describe-package and it's already there, it will likely turn out to be built-in. You can confirm this by going to the source and looking for a comment string This file is part of GNU Emacs. - for vc.el it's on line 9.

Alex
  • 363
  • 2
  • 11
  • In http://obsidianrook.com/devnotes/joys-of-rcs.html, it mentions getting help using M-x help i m emacs This was written in 2004. What would be the equivalent today? – balanga Oct 04 '23 at 08:43
  • I managed to find a vc.el.gz in /usr/local/share/emacs/29.1/lisp/vc along with a vc.elc, but it doesn't show up when running ~describe-package~, but I assume it must be included somehow. – balanga Oct 04 '23 at 12:28
  • "Packages" are a relatively new thing for Emacs (only since 24.1), so don't expect standard parts of Emacs to appear in the package manager. A few of them do, but only because they've been given special treatment (I count 71 of those, vs the 1632 .el files in the source). – phils Oct 04 '23 at 13:43