mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
added git bare functionality to magit
This commit is contained in:
@@ -558,6 +558,27 @@ Adding packages for programming langauges, so we can have nice things like synta
|
|||||||
A git client for Emacs. Often cited as a killer feature for Emacs.
|
A git client for Emacs. Often cited as a killer feature for Emacs.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
(setq bare-git-dir (concat "--git-dir=" (expand-file-name "~/.dotfiles")))
|
||||||
|
(setq bare-work-tree (concat "--work-tree=" (expand-file-name "~")))
|
||||||
|
;; use maggit on git bare repos like dotfiles repos, don't forget to change `bare-git-dir' and `bare-work-tree' to your needs
|
||||||
|
(defun me/magit-status-bare ()
|
||||||
|
"set --git-dir and --work-tree in `magit-git-global-arguments' to `bare-git-dir' and `bare-work-tree' and calls `magit-status'"
|
||||||
|
(interactive)
|
||||||
|
(require 'magit-git)
|
||||||
|
(add-to-list 'magit-git-global-arguments bare-git-dir)
|
||||||
|
(add-to-list 'magit-git-global-arguments bare-work-tree)
|
||||||
|
(call-interactively 'magit-status))
|
||||||
|
|
||||||
|
;; if you use `me/magit-status-bare' you cant use `magit-status' on other other repos you have to unset `--git-dir' and `--work-tree'
|
||||||
|
;; use `me/magit-status' insted it unsets those before calling `magit-status'
|
||||||
|
(defun me/magit-status ()
|
||||||
|
"removes --git-dir and --work-tree in `magit-git-global-arguments' and calls `magit-status'"
|
||||||
|
(interactive)
|
||||||
|
(require 'magit-git)
|
||||||
|
(setq magit-git-global-arguments (remove bare-git-dir magit-git-global-arguments))
|
||||||
|
(setq magit-git-global-arguments (remove bare-work-tree magit-git-global-arguments))
|
||||||
|
(call-interactively 'magit-status))
|
||||||
|
|
||||||
(use-package magit)
|
(use-package magit)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user