MAGIT
Making Git so easy, we say it’s Magit!
Aaron Peters uses the Emacs Git client Magit to perform a long overdue update of his LXF repository.
OUR EXPERT
Aaron Peters is a long-time Linux user, but still quite the Emacs neophyte. Nothing a few decades’ more experience won’t fix. In the meantime, being a software designer will have to suffice.
Magit’s status screen displays the repo’s current state plus its recent commits, which can be expanded to show details.
Git was developed as a tool to manage the development of code by teams, including versioning and collaborating. In other words, a tool for developers. But its use is now so pervasive in the open source world that most serious users of Linux should be able to use it. While you may not write software, some applications’ authors provide it for installation by cloning the repository. Additionally, participating in online projects may require you to make your contributions (see LXF298 for a summary of non-code input) to a GitHub or GitLab repository.
But Git is a sizable application, with lots of subcommands and options. If you’re simply a studious Linux user, rather than a developer or sysadmin, you may not be called upon to use it every day. The learning curve can therefore be pretty steep. This article will introduce Magit, an Emacs package that provides what some call the best GUI for Git. Let’s get started.
Why Magit?
Magit (https://magit.vc) is a package for Emacs written in Lisp, so you need to install Emacs to use it. But why use this compared to some of the other GUI apps for Git? There’s a couple of compelling reasons.
QUICK TIP
If you’re interested in Magit but not Emacs, add the following to the end of the ~/.emacs.d/ init.el file after installing to launch straight into Magit: (require ‘magit) (magit-status)
The package-install command makes installing Magit, including its dependencies, a breeze. You can also use it to keep it all up to date.
The primary reason is that it provides a complete interface to
Git.
Many
Git
clients offer a graphical way to do a limited number of actions. And while a GUI does
help with the learning curve, you may have to resort to the command line if you get stuck – and if you’re new to
Git,
you will get stuck at some point. By familiarising yourself with Magit, you can take advantage of the GUI and have complete functionality at your fingertips.
Speaking of fingertips, like most things Emacs, Magit is largely focused on the keyboard. Once you get used to Magit’s key commands, you’ll be flying through your commits without the need to constantly reach for the mouse. The UI for Magit is also designed to evoke – but not reproduce exactly– the results of terminal commands. This means if you ever do need or want to use command-line Git, things will look very familiar. Of course, for existing or prospective users, it enables you to live your life in the delightful Emacs environment (see LXF241 and LXF260 for other swell things it can do).