Emacs: git, magit-mode
Magit tutorial for beginner.
All you need to know is Alt+x
magit-status and 6 keys:
- Toggle show diff.
- c c
Following are details.
magit-mode is the best interface to the git version control system.
I assume you have used the following git commands in terminal:
[see Git Basics]
Install Magit Mode
Install it thru MELPA. [see Emacs: Install Package with ELPA/MELPA]
Using Magit to add, commit, push
First, open a git controlled file, or open its directory in dired.
magit-status to see the project's status.
Move cursor to a line, press Tab to toggle “diff”. (Command name
- Press s
Add the file under cursor to stage. (
- Press S
Add all tracked files to stage. (
- Press u
Unstage the file under cursor. (
- Press U
Unstage all staged files. (
- Press c c
Write a commit message, then Ctrl+c Ctrl+c to commit. (
- Press P
- Press F
magit-log to see your commit log. Press Enter on a line to see its diff.
Magit comes with complete documentation. It's at the same dir
magit-mode.el is at.
To view the doc:
describe-function【Ctrl+h f】, then type
- Click on the file name to open the source code file, then Alt+x
dired-jump【Ctrl+x Ctrl+j】 to go into that dir. You'll see a file named
universal-argument【Ctrl+u】, then Alt+x
info【Ctrl+h i】, then type the file name.
Once you've done this, the Magit doc is added to the info index. So, you can just call
info 【Ctrl+h i】 to view it next time.
[see Emacs: View Info Page]