简体   繁体   English

Magit运行git commit需要永远

[英]Magit running git commit takes forever

I am using Emacs on Mac OS with the package Magit. 我在Mac OS上使用Magit软件包使用Emacs。 Everything works fine except when I try to do a commit (shortcut: cc ). 一切正常,除非我尝试进行提交(快捷方式: cc )。 Magit hangs with this message in the bottom bar: "running git commit". Magit在底部栏中挂起此消息:“正在运行git commit”。 What is weird is that when I stop the command (Ctrl-g), magit shows me the buffer to write my commit message and everything works fine. 奇怪的是,当我停止命令(Ctrl-g)时,magit向我显示了写入提交消息的缓冲区,并且一切正常。 I don't know why this happens. 我不知道为什么会这样。

with-editor-emacsclient-executable

is set to /usr/local/Cellar/emacs/HEAD/bin/emacsclient . 设置为/usr/local/Cellar/emacs/HEAD/bin/emacsclient

and calling /usr/local/Cellar/emacs/HEAD/bin/emacsclient filename directly from the console seems to work. 并直接从控制台调用/usr/local/Cellar/emacs/HEAD/bin/emacsclient文件名似乎有效。

Thank you for your help! 谢谢您的帮助!

It seems to be a common problem when dealing with a large repo or a repo that has been around for a long time. 在处理大型回购或已存在很长时间的回购时,这似乎是一个常见问题。 Try cleaning up the repo. 尝试清理仓库。 You can use these: 您可以使用这些:

git remote prune origin
git gc

From the official docs: 从官方文档:

git remote prune origin

Deletes all stale remote-tracking branches under name . 删除下的所有陈旧远程跟踪分支name These stale branches have already been removed from the remote repository referenced by name , but are still locally available in "remotes/ name ". 这些陈旧的分支已从name引用的远程存储库中删除,但仍可在本地使用“ remotes / name ”。

git gc

Runs a number of housekeeping tasks within the current repository, such as compressing file revisions (to reduce disk space and increase performance) and removing unreachable objects which may have been created from prior invocations of git add. 在当前存储库中运行许多内务处理任务,例如压缩文件修订版(以减少磁盘空间并提高性能)以及删除可能由先前的git add调用创建的无法访问的对象。

Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance. 鼓励用户在每个存储库中定期运行此任务,以保持良好的磁盘空间利用率和良好的运行性能。

Could be an issue with large diffs too: 也可能是较大差异的问题:

https://github.com/magit/magit/issues/2048 https://github.com/magit/magit/issues/2048

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM