;;; 501-git.el --- git user adaptions ;;; Commentary: ;;; Code: ;; loading standard git.el ;;(require 'git) ;; load magit for git handling (use-package magit :ensure t :bind (("C-x g" . magit-status) ("C-c g" . magit-status) :map magit-status-mode-map ("TAB" . magit-section-toggle) ("" . magit-section-cycle) :map magit-branch-section-map ("RET" . magit-checkout)) :config (add-hook 'after-save-hook 'magit-after-save-refresh-status) (setq magit-use-overlays nil magit-section-visibility-indicator nil magit-completing-read-function 'ivy-completing-read magit-push-always-verify nil magit-repository-directories '("~/src/")) (use-package git-timemachine :bind (("C-x v t" . git-timemachine))) (use-package git-link :bind (("C-x v L" . git-link)) :init (setq git-link-open-in-browser t)) (use-package pcmpl-git) (defun visit-pull-request-url () "Visit the current branch's PR on Github." (interactive) (browse-url (format "https://github.com/%s/pull/new/%s" (replace-regexp-in-string "\\`.+github\\.com:\\(.+\\)\\.git\\'" "\\1" (magit-get "remote" (magit-get-remote) "url")) (cdr (magit-get-remote-branch))))) (bind-key "v" 'visit-pull-request-url magit-mode-map) ;; Do Not Show Recent Commits in status window ;; https://github.com/magit/magit/issues/3230#issuecomment-339900039 (magit-add-section-hook 'magit-status-sections-hook 'magit-insert-unpushed-to-upstream 'magit-insert-unpushed-to-upstream-or-recent 'replace)) ;; load forge to handle github, gitlab, etc ;;(require 'forge) (use-package forge :after magit) (defvar my/magit-default-options `( (pulling "--rebase") )) ;;(advice-add 'magit-key-mode :filter-args #'magit-key-mode--add-default-options) (provide '501-git) ;;; 501-git.el ends here