Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use git from emacs [closed]

Tags:

git

emacs

The previous answers on this topic seem out of date so I am asking again in search of more timely info.

I use emacs development sources (24.0.50.1) to build my own emacs. Yes, I drank the Kool-Aid.

I recently started using git to clone development repositories and for my own projects. I want to use of git from within emacs, and I only want to learn one interface.

It appears that vc-git and magit are the leading choices. Is that right?

It looks like vc-git would be the way to go if I often used other VC systems (which I don't), and that magit is the best fit since I only plan to use git.

Does that sound right? Or am I missing something?

like image 877
myglc2 Avatar asked May 08 '11 03:05

myglc2


People also ask

How to use Magit in Emacs?

To use Magit, type M-x magit-status or C-x M-g j . You can also type C-x p m to open a Magit status buffer in your project root, if you use that functionality in Emacs. The status window is the most common entryway into Magit, but it is not the only one.

How do I exit Git from terminal?

If you don't provide this, and instead type git commit , you'll be taken to your terminal's text editor instead. Generally this is Vim. To exit it (without saving), press the escape key, then type q! and press enter. To exit with saving, type wq!

How do I commit in emacs?

After having selected the files you want to commit, you type either c or C which brings up a special buffer *cvs-commit* . You type in the log message describing the changes you're about to commit (see Log Edit Mode). When you're happy with it, you type C-c C-c to do the actual commit.

What is EMAC Git?

Magit is a complete text-based user interface to Git. It fills the glaring gap between the Git command-line interface and various GUIs, letting you perform trivial as well as elaborate version control tasks with just a couple of mnemonic key presses.


1 Answers

Magit is a wonderful choice because it gives you a good project-level view of your repo and its history, and lets you do neat things like stage/unstage individual diff hunks in the files you've edited. Plus, it's very actively used and maintained.

I personally use vc-git in addition to magit; it's handier than magit for various operations on the current file, e.g. viewing a diff (C-x v =), getting the file's history (C-x v l) or reverting the file to a pristine state (C-x v u).

BTW, magit's home on the web recently changed to this: https://github.com/magit/magit

like image 55
sanityinc Avatar answered Oct 09 '22 05:10

sanityinc