I'm a fan of version control systems, but for some reason I end up not using them as regularly as I should, and then I tend to forget how to do the most common operations, so this time I'm logging it here.
I do all my editing from inside Emacs, so I will be using VC, which allows me to use a version control system from within Emacs. VC works with many different version control systems, but for the moment I will use it with a very simple one: RCS. Later on, perhaps I will need a more sophisticated one, since RCS does not work over a network, and it only works at the level of individual files, but for the moment this is all I need.
The integration Emacs-RCS is very tight, and the basics for checking-in, checking-out are just performed with the same command: C-x v v. The first time we do this command, Emacs will offer to create the RCS directory, if it doesn't exist, and it will register (and unlock) the file as version 1.1. To edit the file again, just type C-x v v again to lock the file. When done and when we register the file again, the *VC-log* buffer will open, so that we can add a log entry. We continue this way, so that different versions of the file will be registered.
So now, some of the most common things that I need to do:
* Be able to see what has been changed in the file:
- When editing the file: C-x v =
- When writing the log entry: C-c C-d in the *VC-log* window (after saving the file being edited)
* Compare different versions:
Perhaps the most flexible one is just to type C-x v ~ REVISION, which allows us to view any previouos revision of the file, and then we can compare any two versions with something like ediff-buffers
* See history of changes:
C-x v l gives us the revision control change history. In a different buffer, we will have a list of all the revisions made to the file, together with the text of the log entries. This buffer is also very convenient to do some useful operations:
- With p and n, we can go the the lines corresponding to the previous or the next revision respectively.
- With e we can modify the log entry text.
- With f we can visit the revision indicated at the current line (like C-x v ~ above).
- With d see the diff between the revision at the current line and the next earlier revision.
* Undo changes:
C-x v u revert the file to the revision from which you started editing.
Later on I will add to my daily version control fix how to work with branches, but for the moment this is 90% of what I really need from a CVS.
No comments:
Post a Comment