退出Vim而不在Git中进行更改 [英] Exit Vim without committing changes in Git

查看:320
本文介绍了退出Vim而不在Git中进行更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 git commit --amend git rebase -i 时,vim为我打开变化。如果我然后改变主意并退出vim而不作任何改变,那么仍然会提交一个提交,它显示在 git reflog 中。



如何在不提交任何内容的情况下退出编辑器?

解决方案

为了让git在您未执行 git commit --amend git rebase -i



只要删除邮件(并保存)即可。所有的git都在寻找一个非空的消息来查看是否发生了有效的提交。由于有一个提交信息(因为你之前提交了一些信息),git认为它是一个有效的提交或rebase。


When I use git commit --amend or git rebase -i, vim opens up for me to make changes. If I then change my mind and exit vim without making any changes, a commit is still made which shows up in git reflog.

How do I exit the editor without committing anything?

解决方案

To get git to not make a change when you are executing git commit --amend or git rebase -i.

Just delete the message (and save). All git does is look for a non empty message to see if a valid commit happened. Since there is a commit message (because you commited something before) git thinks that its a valid commit or rebase.

这篇关于退出Vim而不在Git中进行更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆