Last active
February 18, 2017 02:05
-
-
Save caiorss/19d37497ffb65853e0d8b3563f134ffa to your computer and use it in GitHub Desktop.
Magit with multiple profiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; ================= Way 1 ================= | |
;; Before commit with work profile use M-x magit-status-work | |
;; | |
(defun magit-status-work () | |
(interactive) | |
(setenv "GIT_AUTHOR_NAME" "work user") | |
(setenv "GIT_AUTHOR_EMAIL" "[email protected]") | |
(magit-status default-directory)) | |
;; Before commit with home profile use M-x magit-status-home | |
;; | |
(defun magit-status-home () | |
(interactive) | |
(setenv "GIT_AUTHOR_NAME" "home-user") | |
(setenv "GIT_AUTHOR_EMAIL" "[email protected]") | |
(magit-status default-directory)) | |
;;; ============== Way 2 ================== | |
;; | |
;; set magit user definitively for current Emacs session before run magit-status. | |
;; | |
(defun magit-home-mode () | |
(interactive) | |
(setenv "GIT_AUTHOR_NAME" "home-user") | |
(setenv "GIT_AUTHOR_EMAIL" "[email protected]")) | |
(defun magit-work-mode () | |
(interactive) | |
(setenv "GIT_AUTHOR_NAME" "work user") | |
(setenv "GIT_AUTHOR_EMAIL" "[email protected]")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment