- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在寻找一些帮助,请使用 Emacs/Magit 将本地存储库更改一举推送到远程网站和 Github。
我找到了一个非 Emacs/非 Magit 相关线程 (https://stackoverflow.com/a/3195446/2112489),其中评论指出这是推送到远程和 Github 的最终答案,并且有几百个赞。我认为(可能不正确)这是我计算机上 .gitconfig
目录中本地 $HOME
文件的一个很好的起点。
[remote "GitHub"]
url = git@github.com:elliottcable/Paws.o.git
fetch = +refs/heads/*:refs/remotes/GitHub/*
[branch "Master"]
remote = GitHub
merge = refs/heads/Master
[remote "Codaset"]
url = git@codaset.com:elliottcable/paws-o.git
fetch = +refs/heads/*:refs/remotes/Codaset/*
[remote "Paws"]
url = git@github.com:Paws/Paws.o.git
fetch = +refs/heads/*:refs/remotes/Paws/*
C-u P P [and then use arrow keys to select from the choices in the minibuffer] RET
/usr/local/git/bin/git remote -v
获取已经配置好的remote列表,然后用结果推送到每一个。 . .可行,但复杂。
$ MP:my_project.git HOME$ /usr/local/git/bin/git remote -v
origin git@github.com:lawlist/my_project.git (fetch)
origin git@github.com:lawlist/my_project.git (push)
remote_website lawlist@my-website.com:my_project.git (fetch)
remote_website lawlist@my-website.com:my_project.git (push)
;; Setup the remote repository and the hook; and the remote destination folder.
ssh lawlist@my-website.com
mkdir /home/lawlist/my_project.git
cd my_project.git
git init --bare
;; git update-server-info # If planning to serve via HTTP
cat > /home/lawlist/my_project.git/hooks/post-receive ;; RET
#!/bin/sh ;; RET
GIT_WORK_TREE=/home/lawlist/my_project git checkout -f ;; RET
;; C-d
chmod 755 /home/lawlist/my_project.git/hooks/post-receive
mkdir /home/lawlist/my_project
exit
;; On local machine.
mkdir /Users/HOME/.0.data/.0.emacs/elpa/my_project.git
touch /Users/HOME/.0.data/.0.emacs/elpa/my_project.git/README.md
cd /Users/HOME/.0.data/.0.emacs/elpa/my_project.git
/usr/local/git/bin/git init
/usr/local/git/bin/git add .
/usr/local/git/bin/git commit -m "First commit."
curl -u lawlist:12345678 https://api.github.com/user/repos -d '{"name":"my_project.git"}'
/usr/local/git/bin/git remote add origin git@github.com:lawlist/my_project.git
/usr/local/git/bin/git remote add remote_website lawlist@my-website.com:my_project.git
/usr/local/git/bin/git push origin master
/usr/local/git/bin/git push remote_website master
;; For modification of local files
/usr/local/git/bin/git add .
/usr/local/git/bin/git commit -m "This is a modification . . . ."
/usr/local/git/bin/git push origin master
/usr/local/git/bin/git push remote_website master
最佳答案
编辑 (2014 年 4 月 23 日):添加了一个非 Magit 解决方案来暂存、提交所有(带有默认提交消息)并推送到所有远程。
编辑 (2014 年 4 月 24 日):所有进程的打印输出现在发送到 git-status-buffer
,它显示在函数的末尾——用户可以选择对窗口做什么——例如,删除窗口、删除缓冲区和窗口,或者什么都不做。添加了一些漂亮的颜色 (propertize "[...]" 'face 'font-lock-warning-face)
.依赖于预先存在的 Magit 安装的功能的初稿已移至此答案的底部——该功能有效,但不如不依赖于安装 Magit 的当前版本那么复杂。
(defvar git-status-buffer "*GIT-STATUS*"
"The buffer name of the git-status-buffer.")
(defvar git-branch-name nil
"The current branch of the working Git directory.")
(make-variable-buffer-local 'git-branch-name)
(defvar git-remote-list nil
"List of remote locations -- e.g., lawlist_remote or github_remote.")
(make-variable-buffer-local 'git-remote-list)
(defvar git-commit-message (format "Committed -- %s" (current-time-string))
"The predetermined Git commit message.")
(make-variable-buffer-local 'git-commit-message)
(defun git-branch-process-filter (proc string)
(with-current-buffer (get-buffer git-status-buffer)
(set (make-local-variable 'git-branch-name)
(car (split-string string "\n")))))
(defun git-push-process-filter (proc string)
(when (string-match "password" string)
(process-send-string
proc
(concat (read-passwd "Password: ") "\n")))
(when (and
(not (string-equal "Password: " string))
(not (string-equal "\n" string))
(not (string-equal "stdin: is not a tty\n" string)))
(with-current-buffer git-status-buffer
(goto-char (point-max))
(insert "\n" (replace-regexp-in-string "\^M" "\n" string)))))
(defun git-push-process-sentinel (proc string)
(when (= 0 (process-exit-status proc))
(with-current-buffer (get-buffer git-status-buffer)
(insert
"\n"
(propertize
(format "Process `%s` has finished pushing to `%s`." proc git-remote-name)
'face 'font-lock-warning-face)
"\n"))
(throw 'exit nil)))
(defun stage-commit-push-all ()
"This function does the following:
* Save the current working buffer if it has been modified.
* Obtain the name of the selected branch in the current working buffer.
* Gather a list of all remotes associated with working directory Git project.
* Stage all -- `/usr/local/git/bin/git add .`
* Commit all -- `/usr/local/git/bin/git commit -m [git-commit-message]`
* Push to all remotes: `/usr/local/git/bin/git push -v [remote] [current-branch]`"
(interactive)
(when (buffer-modified-p)
(save-buffer))
(when (get-buffer git-status-buffer)
(with-current-buffer (get-buffer git-status-buffer)
(kill-local-variable 'git-remote-list)
(kill-local-variable 'git-branch-name)
(erase-buffer)))
(start-process
"current-branch"
git-status-buffer
"/usr/local/git/bin/git"
"rev-parse"
"--abbrev-ref"
"HEAD")
(set-process-filter (get-process "current-branch") 'git-branch-process-filter)
(set-process-sentinel
(get-process "current-branch")
(lambda (p e) (when (= 0 (process-exit-status p))
(set-process-sentinel
(start-process
"list-remotes"
git-status-buffer
"/usr/local/git/bin/git"
"remote"
"-v")
(lambda (p e) (when (= 0 (process-exit-status p))
(let* (
beg
end
git-remote-name)
(with-current-buffer (get-buffer git-status-buffer)
(goto-char (point-max))
(while (re-search-backward "\(push\)" nil t)
(beginning-of-line 1)
(setq beg (point))
(re-search-forward "\t" nil t)
(setq end (- (point) 1))
(setq git-remote-name (buffer-substring-no-properties beg end))
(setq git-remote-list
(append (cons git-remote-name git-remote-list)))) ))
(set-process-sentinel
(start-process
"stage-all"
git-status-buffer
"/usr/local/git/bin/git"
"add"
".")
(lambda (p e) (when (= 0 (process-exit-status p))
(with-current-buffer (get-buffer git-status-buffer)
(goto-char (point-max))
(insert "\n"))
(set-process-sentinel
(start-process
"commit-all"
git-status-buffer
"/usr/local/git/bin/git"
"commit"
"-m"
git-commit-message)
(lambda (p e) (when (= 0 (process-exit-status p))
(mapcar (lambda (git-remote-name)
(let ((proc
(start-process
"push-process"
git-status-buffer
"/usr/local/git/bin/git"
"push"
"-v"
(format "%s" git-remote-name)
(format "%s"
(with-current-buffer (get-buffer git-status-buffer)
git-branch-name)) )))
(set-process-filter proc 'git-push-process-filter)
(set-process-sentinel proc 'git-push-process-sentinel)
(recursive-edit) ))
(with-current-buffer (get-buffer git-status-buffer)
git-remote-list) )
(display-buffer (get-buffer git-status-buffer))
(message (concat
git-status-buffer
" -- ["
(propertize "d" 'face 'font-lock-warning-face)
"]elete window | ["
(propertize "k" 'face 'font-lock-warning-face)
"]ill buffer + delete window | ["
(propertize "n" 'face 'font-lock-warning-face)
"]othing"))
(let* (
(git-window-options (read-char-exclusive))
(target-window (get-buffer-window git-status-buffer)))
(cond
((eq git-window-options ?d)
(with-current-buffer (get-buffer git-status-buffer)
(delete-window target-window)))
((eq git-window-options ?k)
(with-current-buffer (get-buffer git-status-buffer)
(delete-window target-window)
(kill-buffer (get-buffer git-status-buffer))))
((eq git-window-options ?n)
(message "Done!"))
(t (message "You have exited the sub-function.")) ))
)))))))))))))
(defun push-to-all-remotes ()
"This function requires a pre-existing installation of Magit, and the function assumes
that the user has already staged and committed -- i.e., it only pushes to all remotes."
(interactive)
(let* (beg end remote)
(when (get-buffer "*REMOTES*")
(with-current-buffer (get-buffer "*REMOTES*")
(erase-buffer)))
(set-process-sentinel
(start-process
"list-remotes"
"*REMOTES*"
"/usr/local/git/bin/git"
"remote"
"-v")
(lambda (p e) (when (= 0 (process-exit-status p))
(with-current-buffer (get-buffer "*REMOTES*")
(goto-char (point-max))
(while (re-search-backward "\(push\)" nil t)
(beginning-of-line 1)
(setq beg (point))
(re-search-forward "\t" nil t)
(setq end (- (point) 1))
(setq remote (buffer-substring-no-properties beg end))
(magit-run-git-async
"push"
"-v"
remote
(magit-get-current-branch))) ))))
(display-buffer (get-buffer magit-process-buffer-name)) ))
关于Emacs -- 如何将一个 Git 存储库推送到多个远程服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23176957/
我通过“emacs --daemon”启动了 emacs 服务器。然后我开了几个客户端。 我想将 .emacs 配置的更改应用于所有客户端,而无需重新启动 emacs 守护程序。这可能吗? 最佳答案
我通过“emacs --daemon”启动了 emacs 服务器。然后我开了几个客户端。 我想将 .emacs 配置的更改应用于所有客户端,而无需重新启动 emacs 守护程序。这可能吗? 最佳答案
我看到了一些关于使 emacs 便携(在 Windows 上)的建议。我的 site-start.el 中有这个: (defvar program-dir (substring data-direct
我是一名狂热的 Vim 用户。我的 Vimrc 有 800 多行。我是一个喜欢定制环境的每个部分的修补匠。 Emacs 似乎更容易配置。所以我尝试一下 Emacs。 当您想要缩小时,请按 Emacs
我是一名狂热的 Vim 用户。我的 Vimrc 有 800 多行。我是一个喜欢定制环境的每个部分的修补匠。 Emacs 似乎更容易配置。所以我尝试一下 Emacs。 当您想要缩小时,请按 Emacs
偶尔在term中使用emacs时模式我会误运行emacs file而不仅仅是打开文件。这将在当前客户端内创建一个嵌套的 emacs 客户端。我的问题是如何只关闭内部客户端? 最佳答案 回答 您应该可以
我一直在慢慢学习 elisp 和 emacs 的新命令,并且一直在稳步构建我的 .emacs。必须保持控制台打开以重复打开和关闭 emacs 实例似乎不是测试的最佳选择,但是从 emacs 中运行 e
我正在寻找一个 emacs 服务器,以便 emacsclients 指定的文件 是相对于 emacsclients 的文件系统而不是服务器的文件系统。例如,如果我设置一个 机器“darkstar”上的
我试图将我所有的 emacs 配置置于版本控制之下,以便在不同的计算机之间轻松切换。实际上我的首选系统是 OSX (10.8.3) 和来自 http://emacsformacosx.com/ 的 e
我正在学习 emacs,我认为使用 emacs 的内置帮助功能开发设施将真正平滑学习击键的学习曲线。 使用 emacs 的内置帮助功能来查找命令名称及其击键的有效过程是什么? 例如,我忘记了关闭框架的
我一直在尝试将 emacs minibuffer 的字体/字体与 emacs 默认字体分开,但没有太多运气。 具体来说,我有兴趣使 minibuffer 字体大小更大以用于 emacs MULE,因为
大约 4 年以来,我一直是一个相当普通的 emacs 用户,但在自定义 emacs 和排除 elisp 故障时,我仍然是新手。最近,我开始自定义 emacs 作为我的 ruby 开发环境,并且我从
我希望 emacs 能够处理一些耗时的任务,而不阻塞输入。为此,我尝试了(其中插入的意思是用耗时的任务来代替) (call-process "emacs" nil 0 nil "--eval=(ins
我的 init.el 中有这个设置 (desktop-save-mode 1) 这很好用,只是我想知道: 如何更改它以将 .emacs.desktop 文件保存到 ~/.emacs.d 而不是 ~/
我是 Emacs 包的作者,偶尔在处理我的包时,我会遇到一个看起来很有用的函数并在我的代码中使用它。然后,在我发布后不久,有人使用旧的 Emacs 版本(但仍然是我想要支持的版本)会报告该功能未定
我用 (message "..some text...") 在我的 init 文件中,在 EMACS 加载时将消息发送到消息缓冲区。这是我查看我刚刚所做的更改导致启动崩溃的快速方法。 但是,我无法找到
简单的问题,我在 Emacs 中使用通用模式进行颜色编码。除了在这种语言中 " 和 ' 可以用来表示字符串之外,下面的代码很好用,如 'this is a string' 或 “这是一个字符串”。默认
有没有办法让我的 Emacs 以预定义的框架作为我附加的屏幕截图开始?我不太熟悉如何在我的 .emacs 脚本中执行此操作... 就这么简单: split-window-horizontally(
在emacs markdown-mode写markdown时,我想让electric-pair-mode自动关闭**bold**和 *italic*成对语法,即当输入一个 * 一秒时 * 应该自动出现
Emacs 是否有一个简单的原始缩进模式可以执行以下操作: 当我转到新行(按 Enter)时,复制上述行 用于缩进的任何空格 当我按 Tab 时,在我按 Tab 的地方插入可以配置的缩进字符(空格/制
我是一名优秀的程序员,十分优秀!