This file contains 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
(defun magit-status-parent () | |
"Open the magit status of a parent git repository. Useful for | |
dealing with submodules. Suggest binding to SPC g p for Spacemacs. | |
(spacemacs/set-leader-keys \"gp\" 'magit-status-parent) | |
" | |
(interactive) | |
(let* ((child-directory (magit-toplevel default-directory)) | |
(parent-directory (and child-directory | |
(magit-toplevel (file-name-directory | |
(directory-file-name child-directory)))))) | |
(if (null child-directory) | |
(user-error "No child git repository in %s." default-directory) | |
(if (null parent-directory) | |
(user-error "No parent git repository in %s." child-directory) | |
(magit-status parent-directory))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment