summaryrefslogtreecommitdiff
path: root/config.org
diff options
context:
space:
mode:
Diffstat (limited to 'config.org')
-rw-r--r--config.org27
1 files changed, 27 insertions, 0 deletions
diff --git a/config.org b/config.org
index a9292d6..d2ad742 100644
--- a/config.org
+++ b/config.org
@@ -1171,6 +1171,33 @@ Copies the resulting URL to the kill ring and clipboard."
(my/snip-upload (read-file-name "Upload to snips.sh: ")))
#+end_src
+** my/setup-git-remote
+
+Set up dual-push git remotes for the current repository. Prompts for
+the repo name on dev.cashmere.rs and sr.ht, then configures origin to
+push to both servers. sr.ht auto-creates repos on first push.
+
+#+begin_src emacs-lisp
+(defun my/setup-git-remote (dev-name srht-name)
+ "Set up origin (dual-push) and backup remotes for the current git repo.
+DEV-NAME is the repo name on dev.cashmere.rs, SRHT-NAME on sr.ht."
+ (interactive
+ (let* ((dev (read-string "Repo name (dev.cashmere.rs): "))
+ (srht (read-string (format "Repo name (sr.ht) [%s]: " dev) nil nil dev)))
+ (list dev srht)))
+ (let* ((root (or (locate-dominating-file default-directory ".git")
+ (error "Not in a git repository")))
+ (default-directory root)
+ (dev-url (format "ssh://git@dev.cashmere.rs/cashmere/%s" dev-name))
+ (srht-url (format "git@git.sr.ht:~cashmere/%s" srht-name)))
+ (shell-command (format "git remote remove origin 2>/dev/null; git remote add origin %s" dev-url))
+ (shell-command (format "git remote set-url --add --push origin %s" dev-url))
+ (shell-command (format "git remote set-url --add --push origin %s" srht-url))
+ (shell-command (format "git remote remove backup 2>/dev/null; git remote add backup %s" srht-url))
+ (message "Remotes configured:\n origin -> %s (push to both)\n backup -> %s"
+ dev-url srht-url)))
+#+end_src
+
** my/paste-md-to-org
[[http://yummymelon.com/devnull/import-markdown-to-org-with-the-clipboard-in-emacs.html][nfdn: Import Markdown to Org with the Clipboard in Emacs]]