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:
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
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.
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:46C-h i g (emacs)Version Control
– phils Oct 03 '23 at 08:13C-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 typeC-h r
to get to the top level of that manual, and search forVersion 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:04vc.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