终端中的撤消树样式git

时间:2013-02-08 09:07:07

标签: git emacs

Emacs有一个软件包可以让你使用撤消树,而不只是前进和后退,撤消:http://www.emacswiki.org/emacs/UndoTree

git是否有类似的东西,它可以让你查看提交树并选择一个?在命令行上还是在Emacs中?

enter image description here

注意:我是Emacs的新手,我已经安装了优秀的Emacs Live - https://github.com/overtone/emacs-live - 这似乎包含了magit。 Emacs Live有一个添加自定义的系统 - 文件放在〜/ .live-packs / cannyboy-pack /中。其中有一个init.el文件,它引用另一个文件夹中的文件 - config。所以我添加了(live-load-config-file“magit-custom.el”)并在config中添加了一个带有@ event_jr代码的magit-custom.el文件,然后在〜/ .live-packs / cannyboy-pack中引用它/init.el通过添加(live-load-config-file“magit-custom.el”)

2 个答案:

答案 0 :(得分:3)

在Emacs中,您可以看到文件的git提交日志树,其中包含magit的magit-file-log 命令,然后按 RETURN 打开日志的差异。我们可以 构建在magit和Emacs的内部版本控制感知功能之上 直接访问该文件。

  1. 下载安装magit
  2. 添加到“init.el”

    (defun my-magit-visit-file-at-commit (&optional other-window)
      "Visit current commit's file in another window.
    
    This command makes sense from a `magit-file-log' buffer. "
      (interactive "P")
      (magit-section-action (item info "visit")
        ((commit)
         (let ((filename (expand-file-name (car magit-refresh-args)
                                           (concat (magit-git-dir) "../"))))
           (if (file-readable-p filename)
               (progn
                 (find-file-noselect filename)
                 (with-current-buffer (find-buffer-visiting filename)
                   (vc-revision-other-window info)))
             (message "not able to access %s" filename))))))
    
    (eval-after-load "magit.el"
      '(define-key magit-log-mode-map (kbd "C-c o") 'my-magit-visit-file-at-commit))
    
  3. 重启Emacs

  4. 打开您感兴趣的提交历史记录的文件。
  5. M-x magit-file-log
  6. 转到有趣的提交新闻 C-c o
  7. 修改修复缺少的键盘规范。

答案 1 :(得分:1)

我认为magit正是您所寻找的。 Here is a good tutorial显示它的用途。

您还应该看看Egg,据说它有更好的用户界面。

相关问题