Magit

From Coder Merlin
Revision as of 16:20, 21 December 2020 by Chukwuemeka-tinashe (talk | contribs)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Magit

Prerequisites[edit]

Background[edit]

Magit provides an easy-to-user interface to git from within emacs.

Introduction[edit]

Magit is a package that runs within emacs and the aim of this package is to provide an interface for the version control system git. The official website of Magit says "Magit aspires to be a complete Git porcelain". So basically, git repository can be accessed well independently from the CLI directly without any mediation but most of the time such a practice becomes cumbersome. Magit does the magic here by providing the scope to the developer to use the git with ease. There are other tools available as well in the form of git extensions which are specific to different IDE or base interface but Magit is one of the most popular one and the only version control tool for git available within emacs. To illustrate further, Magit works as a text based interface somewhere falling between CLI, IDE and GUI while combining all the features of the three.

Magit Illustration.png

Benefits of Magit[edit]

While the reason why you should use Magit for managing your gits will always remain the comfortability and the ease of operations. To be specific, the major operations of git like staging and applying changes is where Magit is truly helpful and can save tons of your time. There are some commands like git add --patch for staging purpose which git itself provides, but due to its difficulty, a lot of developers only use such commands in the case of exceptional scenario. Whereas staging, even in partial way is very easy to execute.

Getting Started with Magit[edit]

To get started with Magit, obviously you need to clone one of your git repository to the codermerlin server which you wish to manage via Magit. There are various ways to do the same. the easiest way is just to execute the following command:

git clone https://github.com/your_git_username/your_git-name.git

Cloning
Snapshot 2.jpg

In this way, the already existing git will get cloned to the codermerlin server space. In this example we are considering a basic example git, the which is available at here.

Once you clone the repository, just enter into emacs interface by first moving inside the repository and then typing emacs.

Snapshot 3.jpg
Snapshot 4.jpg

Features[edit]

The most of the time the visible part of the

Hint.pngHelpful Hint

The default Merlin Server configuration includes CONTROL-x g as a keyboard shortcut for magit-status

Useful Commands[edit]

Show Logs
CONTROL-x g l l
Show Logs (particular file)
CONTROL-x l -- filename l
Show Tags
CONTROL-x g y

Key Concepts[edit]

Exercises[edit]

References[edit]