Created
July 31, 2019 04:50
-
-
Save shanecelis/99bf080c54d78e2cec16db67dadfb686 to your computer and use it in GitHub Desktop.
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
(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