小编Lar*_*ryN的帖子

VSCode Git 退出并保存提交编辑器?

我在 Windows 10 上安装了 Git Bash,我正在关注这个关于在 VSCode 中使用 git 的视频https://youtu.be/MIFQwHlEI9o?t=602,他使用带 -p 选项的 checkout 从提交中挑选片段:

$ git checkout 0903304 index.html -p
diff --git b/index.html a/index.html
index 3ebbb46..d95bb1a 100644
--- b/index.html
+++ a/index.html
@@ -10,6 +10,10 @@
     <ul>
         <li>Item one</li>
     </ul>
+
+    <p>Paragraph one</p>
+    <h1>A title</h1>
+    <div><p>Some text</p></div>

 </body>
 </html>
\ No newline at end of file
Apply this hunk to index and worktree [y,n,q,a,d,e,?]
Run Code Online (Sandbox Code Playgroud)

当我输入“e”时,文件会加载两个版本,并且我的光标会自动放置在编辑器中。进行更改并按 CTRL+S 保存后,我无法退出。我尝试过 q、ESC、CTRL+X、wq、:wq、:x!除了用“x”关闭文件之外没有任何作用,但我得到:

Your edited hunk does not apply. Edit again …
Run Code Online (Sandbox Code Playgroud)

git visual-studio-code

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

git ×1

visual-studio-code ×1