Difference between revisions of "Vc"

From WikEmacs
Jump to navigation Jump to search
(intro)
 
m (→‎Helpful key bindings: (see also diff-mode))
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''vc''' is a [[Version Control]] minor mode. This minor mode is automatically activated whenever you visit a file under
+
{{Package
control of one of the revision control systems.
+
|name=vc
 +
|description=Version control front end for emacs
 +
|author= several authors
 +
|maintainer=[[Andre Spiegel]]
 +
|source=http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/vc/
 +
|in_emacs=yes
 +
|Development status=active
 +
}}
 +
 
 +
'''vc''' is a [[Version Control]] minor mode. This minor mode is
 +
automatically activated whenever a file is opened which is under any
 +
revision control system. It supports many different version control
 +
systems including [[git]], [[bazaar]], [[CVS]] and [[SVN]] etc. It
 +
gives a unique interface to Emacs irrespective of back end  version control system in operation.
 +
 
 +
== Basic setup ==
 +
No particular setup is needed for basic usage. Emacs checks for usage
 +
of version control automatically when a file is being opened.
 +
 
 +
 
 +
== Helpful key bindings ==
 +
 
 +
; {{CommandKeys|C-x v +|vc-update}}
 +
: Update the current fileset's files to their tip revisions.
 +
; {{CommandKeys|C-x v =|vc-diff}}
 +
: Display diffs between file revisions in a buffer using [[diff-mode]].
 +
; {{CommandKeys|C-x v g|vc-annotate}}
 +
: Display the edit history of the current file.
 +
 
 +
== Common customizations ==
 +
 
 +
=== Automatically revert version-controlled buffers ===
 +
Since version controlled files tend to be changed outside of Emacs, it might be useful to automatically activate [[auto-revert-mode]].
 +
 
 +
<source lang="lisp">
 +
;; Activate `auto-revert-mode' for version-controlled files
 +
(defadvice vc-find-file-hook (after auto-revert-mode-for-vc activate)
 +
  "vc-find-file-hook advice for activating `auto-revert-mode'"
 +
  (when vc-mode (auto-revert-mode 1)))
 +
</source>
 +
 
 +
 
 +
== See Also ==
 +
:* [[Magit]]
 +
:* [[diff]]
 +
:* [[ediff]]
 +
 
 +
 
 +
[[Category:Minor Mode]]
 +
[[Category:Version Control]]
 +
[[Category:Major Components of Emacs]]

Latest revision as of 07:31, 4 April 2012

vc is a Version Control minor mode. This minor mode is automatically activated whenever a file is opened which is under any revision control system. It supports many different version control systems including git, bazaar, CVS and SVN etc. It gives a unique interface to Emacs irrespective of back end version control system in operation.

vc
Description Version control front end for emacs
Author several authors
Maintainer Andre Spiegel
Source http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/vc/
Part of Emacs yes

Basic setup

No particular setup is needed for basic usage. Emacs checks for usage of version control automatically when a file is being opened.


Helpful key bindings

[C-x v +] (or M-x vc-update)
Update the current fileset's files to their tip revisions.
[C-x v =] (or M-x vc-diff)
Display diffs between file revisions in a buffer using diff-mode.
[C-x v g] (or M-x vc-annotate)
Display the edit history of the current file.

Common customizations

Automatically revert version-controlled buffers

Since version controlled files tend to be changed outside of Emacs, it might be useful to automatically activate auto-revert-mode.

;; Activate `auto-revert-mode' for version-controlled files
(defadvice vc-find-file-hook (after auto-revert-mode-for-vc activate)
  "vc-find-file-hook advice for activating `auto-revert-mode'"
  (when vc-mode (auto-revert-mode 1)))


See Also