Use gittable of contents in Emacs
- 1. Tool Selection
- 2 installation and configuration
- 3 basic operations
- 4. Submit
- Version 5
- 6. Tag and branch)
- 7. Summary
1 Tool Selection
There are many options to use git in Emacs, such as the old Emacs VC and the classic git. el, powerful Git-Emacs, and trendy magit/egg (egg is a branch of magit ).
Emacs Vc has built-in support in Emacs and works with the backend to support various version control tools, such as CVS, SVN, git, and Hg. However, emacs Vc has a single function, simple and odd operation method.
Git. El is an official tool for git projects, but it has not been updated for a long time. It is said that it does not support some features of git.
Magit and egg personally feel that it is still time to test.
So here we select Git-Emacs.
2 Installation and configuration
After git clone https://github.com/tsgates/git-emacs.git, you only need to add the following in the Emacs configuration file:
; Git-Emacs (add-to-list 'Load-path "/path/to/Git-Emacs/") (require 'git-Emacs)
Then you can use M-x Git-config-init for configuration.
3 Basic operations
If the folder of the currently opened file is in version control, you can view the status through M-x Git-status, such:
On this interface, you can use the following commands:
Key |
Command |
Comment |
P/N |
|
Move up and down all files |
P/N |
|
Move up and down between changed files |
</> |
|
Go to the header/tail of the List |
V |
|
Open a file in read-only mode |
M/u/SPC |
|
Set/cancel/switch tags for Batch File Processing |
A |
|
Add files to Version Control |
I |
|
Add files to ignore |
C |
|
Submit |
For other commands, see the git-Emacs menu.
4 Submit
Use "c" in the status list, or run M-x Git-commit/Git-commit-all/Git-commit-file in any buffer, you can submit index/all files/the current file.
You are required to enter comments when submitting the application, for example:
After entering the note:
5 Version history
Run the M-x Git-history command to view the version history of the entire project. Run the M-x Git-log command to view the version history of the currently marked file. Both commands open a new buffer:
If you like gitk very much, you can also open the gitk window directly through M-x gitk (provided that gitk has been installed:
6 Tag and branch)
M-x Git-branch: Lists All branches. Here, you can create, delete, and switch branches by using the shortcut key C/D/ret.
Tag operations are also simple:
M-x Git-tag can create a tag. You can specify the tag name in Git-checkout, you can also use Git-checkout-to-New-branch to create branches based on tags.
7 Summary
Git-Emacs implements all the features of git command line in Emacs, and is more convenient to use based on the powerful features of Emacs.
With Git-Emacs, you do not need to switch back and forth between Emacs and terminal to improve efficiency.
Author: Holbrook Wong <wanghaikuo@gmail.com>
Date: 09:42:33 CST
HTML generated by org-mode 6.33x in Emacs 23