Two weeks without Magit1 have forced me to rethink how I use Git in my projects. I have already written about some commands I have been using, but beside basic things, how does Emacs hold up in a more complex situation?
Let’s talk about interactive rebasing. If you are familiar with Magit2, you
know how simple it gets. This is what I usually do from magit-status
:
magit-log
current
magit-rebase
interactive
--force-with-lease
enabledIt’s quicker to do it than to write it all down, especially now that it has become muscle memory. No wonder I was still relying on Magit to interactively rebase on my first days with VC.
Since I did not find a similar solution in vc-git
, I asked on emacs-devel
how the core developers approach this workflow: vc-git: interactive
rebasing.
I got different, interesting replies that can be roughly summed up with:
helm-ls-git
Not wanted to be scared away from a non-Magit option, this is what I have eventually ended up doing:
shell-mode
, I run git rebase -i <branch>~<commits>
squash
on the commits I want to squashgit push --force-with-lease
from shell-mode
, or C-u
P from C-x p v to push with --force-with-lease
added
manuallyNote that this approach requires that in ~/.config/git/config
I have editor
set to emacsclient
and either I have server-start
somewhere in my init.el
or I do M-x server-start before starting the actual rebase.
It looks like that even without Magit I can do everything from Emacs, which makes for a good alternative in my opinion. Nonetheless, it does not take a PhD to notice that Magit makes the whole rebasing easier to sort out. Hence, you will not hear me scream “drop it already and party hard, fellas!”. Sorry.