complete-computing-environment/magit.org

73 lines
2.2 KiB
Org Mode

:PROPERTIES:
:ID: cce/magit
:ROAM_ALIASES: Magit
:END:
#+TITLE: Git in Emacs with Magit
#+filetags: :Emacs:CCE:Coding:
#+PROPERTY: header-args :mkdirp yes :results none
#+PROPERTY: header-args:emacs-lisp :tangle magit.el
#+PROPERTY: header-args:yaml :tangle roles/endpoint/tasks/git.yml
#+ARCOLOGY_KEY: cce/magit
#+ARCOLOGY_ALLOW_CRAWL: t
#+ARROYO_MODULE_WANTS: cce/hydra.org
#+ARROYO_EMACS_MODULE: magit
#+ARROYO_HOME_MODULE: hm/git.nix
I use [[https://github.com/syohex/emacs-git-messenger][git-messenger]], [[https://github.com/emacsmirror/git-timemachine][git-timemachine]], and [[https://magit.vc][Magit]] in a custom [[id:cce/hydra][Hydra]] binding. As described in my [[id:cce/basic_emacs_coding_config][Basic Emacs Coding Config]], I use =git= for my source code management, and Magit is a really top-notch frontend for it. It exposes nearly all Git functionality on mnemonic keybindings.
#+begin_src emacs-lisp
(use-package git-timemachine)
(use-package git-messenger)
(use-package magit
:after (git-timemachine git-messenger)
:config
(defhydra hydra-magit (global-map "C-c g" :color teal :hint nil)
"
PROJECTILE: %(projectile-project-root)
Immuting Mutating
-----------------------------------------
_w_: blame line _b_: checkout
_a_: annotate file _B_: branch mgr
_d_: diff _c_: commit
_s_: status _e_: rebase
_l_: log
_t_: time machine
"
("w" git-messenger:popup-message)
("a" vc-annotate)
("b" magit-checkout)
("B" magit-branch-manager)
("c" vc-next-action)
("d" magit-diff-working-tree)
("e" magit-interactive-rebase)
("s" magit-status)
("l" magit-log)
("t" git-timemachine))
:bind
("C-c g" . #'hydra-magit/body)
(:map evil-leader--default-map
("g" . hydra-magit/body)))
(provide 'cce/magit)
#+end_src
#+begin_src nix :tangle ~/arroyo-nix/hm/git.nix
{...}:
{
programs.git = {
enable = true;
userName = "Ryan Rix";
userEmail = "ryan@whatthefuck.computer";
extraConfig = {
core = { excludesfile = "~/.gitignore"; };
init = { defaultBranch = "main"; };
};
};
}
#+end_src