Git branches and Emacs built-in VC
Emacs VC
Emacs VC is the built-in Emacs version control interface.
It is very capable, and its use is intuitive.
Emacs VC can be used with practically all version control systems. I have used it frequently with RCS and CVS.
No need for Magit
For my typical use of Git, VC offers all I need, and I have stopped installing and using Magit.
The default key bindings of VC all start with C-x v
For example, to commit changes, use C-x v v, and
push them with C-x v P.
VC and Git branches
Creating a Git branch with VC
To create a new branch, use C-x v b c
This will prompt for the name of the new branch and ask for the start-point of the branch.
Switching between branches
To switch to a different branch, use C-x v b s.
This will prompt for the name of the branch, you can use completion to select a branch.
Merge
To merge merge changes from another branch in the current, use C-x v m.
This will prompt for the name of the branch, you can use completion to select a branch.
Push and pull
To push to the upstream branch, use C-x v P
To pull from the upstream branch, use C-x v +.
Change log of another branch
To view the change log of another branch, use C-x v b l.
This gives a Git blame like overview of changes of the current fileset.
Overview and commit changes
Display the VC directory byffer with C-x v d.
This is a very useful buffer, and offers convenience like Magit.
It shows the Git status of the current directory and gives a menu to:
- View diffs
- Revert, delete, ignore and commit changes
- Mark and unmark
- Push marked
Try these also
C-x v h (vc-region-history) to view the changes made in the active region.
C-x v O (vc-log-outgoing) to view the changes to be pushed to upstream.
C-x v I (vc-log-incoming) to view the changed to be pulled from upstream.
There is more
All above is of course very well documented in the excellent documentation.
Just try it your self!
VC is built-in, no need to install anything, and worthwhile to explore.
Webrings
100% made with ♥ by a human — no cookies, no trackers.
Proud member of the 250kb.club,
the no-JS.club,
the Blogroll.Club,
and the Bukmark.Club.
Don’t let a billionaire’s algorithm control what you read — use an RSS feed reader.
Most recent pages All tags Sitemap RSS of Gophersite
